/* Portis site: a Swiss public-information sheet.
   One grotesk (Archivo) in two widths and ink bars; the only colour is in the screenshots.
   Order: base, top bar, homepage, reading pages (blog, support, privacy, 404), footer, small screens. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --sheet: #ffffff;
  --sheet-2: #eceef0;
  --ink: #0c0d0e;
  --ink-2: #3a3e44;
  --ink-3: #5d6168;
  --hair: #cdd0d4;

  --pad: clamp(1.25rem, 4.4vw, 3.5rem);
  --max: 82.5rem;
  --gap: 1.5rem;
  --bar: 6px;
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --sheet: #0d0e0f;
    --sheet-2: #1c1e20;
    --ink: #f3f4f4;
    --ink-2: #c5c8cc;
    --ink-3: #9ca0a6;
    --hair: #35383c;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--ink) var(--sheet);
}

body {
  margin: 0;
  background: var(--sheet);
  color: var(--ink);
  font: 420 1.0625rem/1.55 var(--sans);
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  /* Short pages keep the footer at the bottom of the window. */
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
}

::selection { background: var(--ink); color: var(--sheet); }

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, dl, dd, ul, ol, figure, pre { margin: 0; }
p, dd, li, figcaption, td { text-wrap: pretty; }
ul { padding: 0; list-style: none; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 4px; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.ink :focus-visible { outline-color: var(--sheet); }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; font-variant-ligatures: none; }
kbd { font-family: var(--sans); font-weight: 700; font-size: 1em; }
pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  background: var(--sheet-2);
  line-height: 1.5;
  scrollbar-width: thin;
}
/* Block-level so the field keeps its inset at the end of a long, scrolled line. */
pre code { display: block; width: max-content; min-width: 100%; font-size: 0.9375rem; }
pre.soft { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.soft code { width: auto; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.skip {
  position: absolute; left: var(--pad); top: -4rem; z-index: 10;
  padding: 0.6rem 1rem; background: var(--ink); color: var(--sheet); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 0.5rem; }

/* ---------- top bar ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}
.mark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; text-decoration: none;
}
.mark img { border-radius: 6px; }
.top nav { display: flex; align-items: center; gap: clamp(0.9rem, 2.4vw, 1.75rem); font-weight: 600; font-size: 1rem; }
.top nav a { text-decoration: none; padding-block: 0.35rem; }
.top nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.top nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }
.top nav .top-buy { text-decoration: underline; text-decoration-thickness: 2px; font-weight: 800; }
.top nav .top-buy:hover { text-decoration-thickness: 4px; }

/* ---------- homepage: lead ---------- */

.lead {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 1.25rem;
  align-items: end;
  padding-top: clamp(0.75rem, 2.2vw, 1.75rem);
  padding-bottom: clamp(1.25rem, 2.6vw, 2rem);
}
.lead h1, .page-head h1 {
  grid-column: 1 / span 9;
  font-size: clamp(2rem, 1rem + 3vw, 3.25rem);
  font-weight: 800;
  font-stretch: 86%;
  line-height: 0.98;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.lead-buy {
  grid-column: 10 / -1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.7rem;
  padding-bottom: 0.2rem;
}
.lead-buy p { font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); }
.lead-buy strong { color: var(--ink); font-weight: 800; }

.badge { display: inline-block; margin: 12px 0 0; line-height: 0; }
.badge img { height: 48px; width: auto; }
.badge-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .badge-light { display: none; }
  .badge-dark { display: block; }
}

/* ---------- the window ---------- */

.band { background: var(--sheet-2); overflow: clip; }
.band-shot { padding-block: clamp(1.25rem, 2.6vw, 2.25rem) clamp(1.25rem, 2.4vw, 2rem); }
/* Screenshots are cut along the window outline (transparent corners): no frame, no radius here. */
.band-shot img { width: 100%; }

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--sheet);
  font: 800 1rem/1.1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.btn svg { width: 1em; height: 1em; flex: none; }
.btn:hover { background: transparent; color: var(--ink); }

.go { font-weight: 800; text-decoration-thickness: 2px; }
.go svg {
  display: inline-block; width: 0.95em; height: 0.95em; margin-left: 0.45em; vertical-align: -0.1em;
  transition: transform 180ms var(--ease);
}
.go:hover svg { transform: translateX(4px); }

.table-wrap { overflow-x: auto; scrollbar-width: thin; }

/* ---------- sections ---------- */

.sec {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 1.75rem;
  padding-top: clamp(2.5rem, 5vw, 4.25rem);
  padding-bottom: clamp(3rem, 6.5vw, 5.5rem);
  position: relative;
}
.sec::before {
  content: ""; position: absolute; top: 0; left: var(--pad); right: var(--pad);
  border-top: var(--bar) solid var(--ink);
}
.sec--flush::before, .band + .sec::before { display: none; }

.sec > h2, .ink h2 {
  grid-column: 1 / span 5;
  font-size: clamp(1.9rem, 1.1rem + 2.6vw, 3.1rem);
  font-weight: 800; font-stretch: 86%; line-height: 0.98; letter-spacing: -0.022em;
  text-wrap: balance;
}
h2 code { font-size: 0.86em; font-weight: 700; letter-spacing: -0.03em; }
.sec-body { grid-column: 6 / -1; max-width: 41rem; }
.sec-body > p + p, .sec-body > p + pre, .sec-body > pre + p { margin-top: 1rem; }
.more { margin-top: 1.5rem !important; }
.after { grid-column: 1 / -1; }

.does > div, .facts > div {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); column-gap: 1.25rem;
  padding-block: 0.85rem;
  border-top: 1px solid var(--hair);
}
.does > div:first-child, .facts > div:first-child { border-top: 0; padding-top: 0; }
.does dt, .facts dt { font-weight: 800; font-size: 1.125rem; line-height: 1.3; }
.facts > div { grid-template-columns: 12rem minmax(0, 1fr); }

.shot { grid-column: 1 / -1; min-width: 0; }
.shot--side img { border: 1px solid var(--hair); }
/* The detail crop keeps the window's own bottom corners; only the cut edge on top gets a line. */
.shot .pan { overflow-x: auto; scrollbar-width: thin; border-top: 1px solid var(--hair); }
.shot--wide img { width: 100%; min-width: 46rem; }
.shot figcaption { line-height: 1.4; margin-top: 0.6rem; font-size: 0.9375rem; color: var(--ink-2); max-width: 70ch; }
.shot--side { grid-column: 6 / span 6; }
.shot--side img { width: 100%; max-width: 37.5rem; }

/* comparison */
.cmp-wrap { grid-column: 1 / -1; }
.cmp { width: 100%; border-collapse: collapse; border-top: var(--bar) solid var(--ink); }
.cmp thead th { text-align: left; font-size: 0.875rem; font-weight: 800; padding: 0.6rem 1.25rem 0.5rem 0; border-bottom: 2px solid var(--ink); }
.cmp tbody th, .cmp td { text-align: left; vertical-align: top; padding: 0.9rem 1.25rem 0.95rem 0; border-bottom: 1px solid var(--hair); line-height: 1.45; }
.cmp tbody th { width: 22%; font-weight: 800; font-size: 1.125rem; line-height: 1.25; }
.cmp tbody th code { font-size: 0.95em; }
.cmp tbody th small { display: block; margin-top: 0.15rem; font-size: 0.875rem; font-weight: 500; color: var(--ink-3); }
.cmp td { width: 39%; }
.cmp thead th, .cmp tbody th, .cmp td { padding-left: 0.9rem; }
.cmp-own > * { background: var(--ink); color: var(--sheet); border-bottom-color: var(--ink) !important; }
.cmp-own th small { color: var(--sheet) !important; }

/* ink field: macOS 27 */
.ink { background: var(--ink); color: var(--sheet); }
.ink ::selection { background: var(--sheet); color: var(--ink); }
.ink-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 1.75rem;
  padding-block: clamp(3rem, 6vw, 5rem);
}
.ink h2 { grid-column: 1 / span 6; }
.ink .sec-body { grid-column: 8 / -1; }

/* close */
.close { background: var(--sheet-2); }
.close-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 2rem;
  padding-block: clamp(3rem, 6vw, 5rem);
  align-items: start;
}
.close h2 { grid-column: 1 / span 7; line-height: 0.9; }
.close .price {
  display: block;
  font-weight: 900; font-stretch: 62%;
  font-size: clamp(6rem, 2rem + 15vw, 14rem); line-height: 0.82; letter-spacing: -0.012em;
}
.close .once {
  display: block; margin-top: 0.9rem;
  font-size: clamp(1.5rem, 1rem + 1.7vw, 2.4rem); font-weight: 800; font-stretch: 86%; line-height: 1.02; letter-spacing: -0.018em;
}
.close-body { grid-column: 8 / -1; align-self: end; }
.close-body p + p { margin-top: 1.25rem; }
.btn--buy { min-height: 3.25rem; padding-inline: 1.3rem; font-size: 1.0625rem; }
.close-read { grid-column: 1 / -1; border-top: 2px solid var(--ink); padding-top: 1.25rem; }
.close-read h3 { font-size: 1.125rem; font-weight: 800; }
.close-read ul { margin-top: 0.6rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 2rem; }
.close-read a { text-decoration-thickness: 1px; }
.close-read a:hover { text-decoration-thickness: 3px; }

/* ---------- reading pages ---------- */

/* Title at the homepage headline scale, facts in a small block at the right edge. */
.page-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 1rem;
  align-items: end;
  padding-top: clamp(1.25rem, 3.4vw, 2.75rem);
  padding-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.page-lede { grid-column: 1 / span 8; max-width: 44rem; font-size: 1.25rem; line-height: 1.4; font-weight: 500; color: var(--ink-2); }
.page-head .meta { grid-column: 10 / -1; grid-row: 1; padding-bottom: 0.2rem; }
.meta { font-size: 0.9375rem; line-height: 1.4; }
.meta > div { display: grid; grid-template-columns: 5.75rem minmax(0, 1fr); column-gap: 0.75rem; padding-block: 0.15rem; }
.meta dt { font-weight: 800; }
.meta dd { color: var(--ink-2); }

/* Rows: the heading stands in the margin and stays in view, the text runs beside it. */
.rows { padding-bottom: clamp(3rem, 6.5vw, 5.5rem); }
.row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 0.75rem;
  padding-block: 1.4rem 2.5rem;
  border-top: 2px solid var(--ink);
  scroll-margin-top: 0.5rem;
}
.row:first-child { border-top: var(--bar) solid var(--ink); padding-top: 1.75rem; }
.row > h2, .row-side { grid-column: 1 / span 4; }
.row > h2, .row-body > h2 {
  font-size: 1.5rem; font-weight: 800; font-stretch: 86%; line-height: 1.1; letter-spacing: -0.014em;
  text-wrap: balance;
}
.row > h2 a, .row-body > h2 a { text-decoration: none; }
.row > h2 a:hover, .row-body > h2 a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.row-side { font-weight: 600; color: var(--ink-2); }
.row-body { grid-column: 5 / -1; min-width: 0; }

/* Blog index: date in the margin, title and summary beside it. */
.row--post { padding-block: 1.15rem 1.5rem; }
.row--post + .row--post { border-top: 1px solid var(--hair); }
.row--post .row-side { padding-top: 0.3rem; font-size: 0.9375rem; }
.row--post p { max-width: 36rem; margin-top: 0.4rem; color: var(--ink-2); }

/* Prose keeps a reading measure; code and tables may use the whole body column. */
.prose > * { max-width: 36rem; }
.prose > * + * { margin-top: 1rem; }
.prose > .code, .prose > pre, .prose > .table-wrap { max-width: none; }
.prose > .code + *, .prose > * + .code, .prose > .table-wrap + *, .prose > * + .table-wrap { margin-top: 1.25rem; }
.row--intro .prose > p:first-child:not(.review-note), .row--intro .prose > .review-note:first-child + p { max-width: 41rem; font-size: 1.25rem; line-height: 1.45; }
.prose a, .toc a { text-decoration-thickness: 1px; }
.prose a:hover, .toc a:hover { text-decoration-thickness: 3px; }
.prose strong { font-weight: 800; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose ul { list-style: square; }
.prose li + li { margin-top: 0.4rem; }
.prose li::marker { font-weight: 700; }

/* A command sits on a field and can be copied; output is outlined. */
.code { position: relative; }
.code pre { padding-right: 5rem; }
pre.text { background: none; box-shadow: inset 0 0 0 1px var(--hair); }
pre .dim { color: var(--ink-3); }
.copy {
  appearance: none;
  position: absolute; top: 0.5rem; right: 0.5rem;
  min-width: 3.9rem; padding: 0.4rem 0.55rem;
  border: 1px solid var(--ink); border-radius: 0;
  background: var(--sheet); color: var(--ink);
  font: 700 0.8125rem/1 var(--sans);
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.copy:hover, .copy[data-done] { background: var(--ink); color: var(--sheet); }

.prose table { width: 100%; min-width: 34rem; border-collapse: collapse; border-top: 2px solid var(--ink); font-size: 0.9375rem; line-height: 1.4; }
.prose th { text-align: left; vertical-align: bottom; font-size: 0.875rem; font-weight: 800; padding: 0.55rem 1rem 0.5rem 0; border-bottom: 2px solid var(--ink); }
.prose td { vertical-align: top; padding: 0.65rem 1rem 0.7rem 0; border-bottom: 1px solid var(--hair); }
.prose td:first-child { font-weight: 700; }
.prose th:last-child, .prose td:last-child { padding-right: 0; }

.toc { list-style: none; padding: 0; columns: 2; column-gap: var(--gap); max-width: 46rem; font-weight: 600; line-height: 1.35; }
.toc li { break-inside: avoid; padding-block: 0.25rem; }

/* Only in preview builds (no --until): notes for the owner, never published. */
.prose .review-note { padding: 0.65rem 0.85rem; border: 2px dashed var(--ink); font-size: 0.9375rem; line-height: 1.45; }

/* What Portis is, once, at the end of a post. */
.close--about h2 {
  grid-column: 1 / span 6;
  font-size: clamp(1.9rem, 1.1rem + 2.6vw, 3.1rem);
  font-weight: 800; font-stretch: 86%; line-height: 0.98; letter-spacing: -0.022em;
  text-wrap: balance;
}
.close--about .close-body { align-self: start; }
.about-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.1rem; margin-top: 1.5rem; }
.about-buy .badge { margin: 0; }
.about-buy p { margin: 0; font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); }
.about-buy strong { color: var(--ink); font-weight: 800; }

/* ---------- footer ---------- */
.foot {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 0.75rem;
  padding-block: 2rem 3rem; font-size: 0.9375rem; color: var(--ink-2);
}
/* Pages that do not end on a field close the sheet with a rule. */
.foot::before { content: ""; grid-column: 1 / -1; margin-bottom: 1.25rem; border-top: 2px solid var(--ink); }
main:has(> .close:last-child) + .foot::before { display: none; }
.foot > p:first-child { grid-column: 1 / span 6; }
.foot-nav { grid-column: 7 / -1; display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; justify-content: flex-end; }
.foot a { text-decoration-thickness: 1px; }
.foot a:hover { text-decoration-thickness: 3px; }
.foot .legal { grid-column: 1 / span 8; font-size: 0.8125rem; color: var(--ink-3); line-height: 1.45; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .lead h1, .page-head h1, .page-lede { grid-column: 1 / -1; }
  .page-head .meta { grid-column: 1 / -1; grid-row: auto; display: flex; flex-wrap: wrap; gap: 0.1rem 1.75rem; }
  .meta > div { display: flex; gap: 0.4rem; }
  .lead-buy { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 1.1rem; }
}

@media (max-width: 860px) {
  /* Small screens show the top-left crop; it runs off the right edge and scrolls. */
  .band-shot { padding-right: 0; }
  .band-shot .pan { overflow-x: auto; scrollbar-width: thin; }
  .band-shot img { width: 43rem; max-width: none; }

  .sec > h2, .sec-body, .shot--side, .ink h2, .ink .sec-body, .close h2, .close-body { grid-column: 1 / -1; }
  .row > h2, .row-side, .row-body { grid-column: 1 / -1; }
  .row { padding-block: 1.25rem 2rem; }
  .row--post { row-gap: 0.2rem; padding-block: 1rem 1.25rem; }
  .row--post .row-side { padding-top: 0; }
  .sec { row-gap: 1.25rem; }
  .foot > p:first-child, .foot-nav, .foot .legal { grid-column: 1 / -1; }
  .foot-nav { justify-content: flex-start; }
  .close-read ul { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .top nav { font-size: 0.9375rem; }
  /* The price alone on a phone; the full label stays for screen readers. */
  .top-buy span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .badge { margin: 10px 0 0; }
  .badge img { height: 44px; }
  .lead-buy { align-items: flex-end; }
  .does > div, .facts > div { grid-template-columns: 1fr; row-gap: 0.15rem; }
  .shot--side img { height: 16.5rem; object-fit: cover; object-position: 50% 45%; }

  .cmp, .cmp tbody, .cmp tr, .cmp th, .cmp td { display: block; width: auto; }
  .cmp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .cmp tbody tr { padding: 0.9rem 0 1rem; border-bottom: 1px solid var(--hair); }
  .cmp tbody th, .cmp td { width: auto; padding: 0 0.75rem; border: 0; }
  .cmp tbody th small { display: inline; margin-left: 0.5rem; }
  .cmp tbody th { padding-left: 0.75rem; margin-bottom: 0.4rem; }
  .cmp td + td { margin-top: 0.45rem; }
  .cmp td::before { content: attr(data-l); display: block; font-weight: 800; font-size: 0.8125rem; }
  .cmp-own { background: var(--ink); }

  .page-lede, .row--intro .prose > p:first-child:not(.review-note), .row--intro .prose > .review-note:first-child + p { font-size: 1.125rem; }
  .row > h2, .row-body > h2 { font-size: 1.3125rem; }
  .toc { columns: 1; }
  pre code { font-size: 0.8125rem; }
  .code pre { padding-right: 1rem; padding-top: 2.6rem; }

  /* Tables stack: the first cell names the row, the rest carry their column heading. */
  .prose table, .prose tbody, .prose tr, .prose td { display: block; }
  .prose table { min-width: 0; }
  .prose thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .prose tr { padding-block: 0.8rem 0.9rem; border-bottom: 1px solid var(--hair); }
  .prose td { padding: 0; border: 0; }
  .prose td:first-child { margin-bottom: 0.35rem; font-size: 1.0625rem; font-weight: 800; }
  .prose td + td { position: relative; padding: 0.12rem 0 0.12rem 8rem; }
  .prose td + td::before { content: attr(data-l); position: absolute; left: 0; font-weight: 700; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
