/* ==========================================================================
   Pages other than the home page (src/layouts/page.html): the blog, an
   article, the privacy policy and the 404 page. The same language as the
   home page — black canvas, Inter for what people read, IBM Plex Mono for
   labels, the spark for markers — tuned for reading: a narrow column,
   larger type and generous line spacing. No backdrop network here.
   ========================================================================== */

.page main {
  padding-top: var(--header-height);
}

.container--narrow {
  width: min(100% - 2 * var(--gutter), 46rem);
}

/* ---- Page heading -------------------------------------------------------------- */

.page-intro {
  position: relative;
  isolation: isolate;
  padding-block: clamp(4rem, 2.5rem + 6vw, 8rem) clamp(2.5rem, 2rem + 2vw, 4rem);
}

/* the dot field from the home page's intro, fading out before the text gets busy */
.page-intro::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: min(30rem, 100%);
  background: radial-gradient(circle, rgb(255 255 255 / 0.1) 0 1px, transparent 1.5px) 50% 0 / 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 60% 80% at 30% 0%, #000, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 80% at 30% 0%, #000, transparent 75%);
  pointer-events: none;
}

.page-title {
  margin-top: 1.5rem;
  font-size: clamp(2.25rem, 1.5rem + 3vw, 4rem);
  font-weight: 400;
  font-variation-settings: "opsz" 32;
  line-height: 1.06;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.page-intro--center {
  text-align: center;
}

.page-intro--center .eyebrow {
  flex-direction: column;
  gap: 1rem;
}

.page-intro--center .section-lead {
  margin-inline: auto;
}

.page-section {
  padding-bottom: var(--section-space);
}

/* ---- Not published yet ------------------------------------------------------------ */

.draft-banner {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin: 1.5rem auto 0;
  padding: 0.85rem 1.1rem;
  border: 1px dashed rgb(242 163 94 / 0.6);
  border-radius: 0.75rem;
  background: rgb(242 163 94 / 0.08);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ---- Blog: the list ------------------------------------------------------------------ */

.post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.post-list--compact {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 1.25rem;
}

.post-card {
  position: relative;
  display: flex;
}

.post-card article {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  border: 1px solid var(--color-line-soft);
  border-radius: 1.5rem;
  background: linear-gradient(180deg, var(--color-surface-2), var(--color-surface-1) 70%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.07);
  transition: border-color 0.3s ease;
}

.post-card__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}

.post-card__draft {
  color: var(--color-accent);
}

.post-card__title {
  margin-top: 0.85rem;
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  font-weight: 400;
  font-variation-settings: "opsz" 32;
  line-height: 1.2;
  text-wrap: balance;
}

/* the title's link covers the whole card */
.post-card__title a {
  color: inherit;
  text-decoration: none;
}

.post-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1.5rem;
}

.post-card__title a:focus-visible {
  outline: none;
}

.post-card__title a:focus-visible::after {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.post-card__description {
  margin-top: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  text-wrap: pretty;
}

.post-card__more {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.post-card__arrow {
  flex: none;
  width: 1.2em;
  height: 0.63em;
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .post-card:hover article {
    border-color: rgb(242 163 94 / 0.45);
  }

  .post-card:hover .post-card__arrow {
    transform: translateX(0.2em);
  }
}

/* nothing published yet: said plainly, with two useful ways on */
.blog-empty {
  max-width: 40rem;
  padding: clamp(1.75rem, 1.25rem + 2vw, 3rem);
  border: 1px solid var(--color-line-soft);
  border-radius: 1.5rem;
  background:
    radial-gradient(70% 60% at 100% 0%, var(--color-accent-glow), transparent 70%),
    var(--color-surface-1);
}

.blog-empty__title {
  margin-top: 1.25rem;
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  font-weight: 400;
  font-variation-settings: "opsz" 32;
  line-height: 1.2;
}

.blog-empty__text {
  margin-top: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.blog-empty__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 1.75rem;
}

/* ---- An article (and the privacy policy) ----------------------------------------------- */

.article__header {
  padding-block: clamp(3rem, 2rem + 4vw, 6rem) 0;
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}

.breadcrumbs__list li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--color-text-dim);
}

.breadcrumbs__list a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumbs__list a:hover {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 0.3em;
}

.article__title {
  margin-top: 1.25rem;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
}

.article__lead {
  margin-top: 1.25rem;
  font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
  line-height: 1.55;
  color: var(--color-text-muted);
  text-wrap: pretty;
}

/* plain text flow (not flex), so the spaces around the separators stay */
.article__meta {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-line-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}

.article__image {
  width: min(100% - 2 * var(--gutter), 60rem);
  margin: clamp(2rem, 1.5rem + 2vw, 3rem) auto 0;
}

.article__image img {
  width: 100%;
  height: auto;
  border-radius: 1.25rem;
}

.article__body {
  padding-top: clamp(2rem, 1.5rem + 2vw, 3rem);
}

/* contents, for longer articles */
.toc {
  margin-bottom: 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-line-soft);
  border-radius: 1rem;
  background: var(--color-surface-1);
}

.toc__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
}

.toc__list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* a dot per heading (the headings may carry their own numbers) */
.toc__list li {
  position: relative;
  padding-left: 1.25rem;
  line-height: 1.45;
}

.toc__list li::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 0.15rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
}

.toc__list a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.toc__list a:hover {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 0.3em;
}

/* ---- Reading text ------------------------------------------------------------------------- */

.prose {
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.15rem);
  line-height: 1.75;
  color: var(--color-text-muted);
}

.prose > * + * {
  margin-top: 1.25em;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--color-text);
  font-weight: 400;
  font-variation-settings: "opsz" 32;
  text-wrap: balance;
}

.prose h2 {
  margin-top: 2.4em;
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin-top: 2em;
  font-size: 1.25em;
  line-height: 1.3;
}

.prose h4 {
  margin-top: 1.75em;
  font-size: 1.05em;
  line-height: 1.4;
}

.prose h2 + *,
.prose h3 + *,
.prose h4 + * {
  margin-top: 0.75em;
}

.prose p {
  text-wrap: pretty;
}

.prose strong {
  color: var(--color-text);
  font-weight: 600;
}

.prose a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color 0.2s ease;
}

.prose a:hover {
  color: var(--color-accent);
}

.prose a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.prose ul,
.prose ol {
  display: grid;
  gap: 0.5em;
  padding-left: 1.5em;
}

.prose ul {
  list-style: none;
}

.prose ul > li {
  position: relative;
}

/* list markers: small dots, like the rest of the site */
.prose ul > li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: -1.15em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
}

.prose ol > li::marker {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--color-accent);
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.5em;
}

.prose blockquote {
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 2px solid var(--color-accent);
  color: var(--color-text);
}

.prose blockquote > * + * {
  margin-top: 0.75em;
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 0.35em;
  background: var(--color-surface-2);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--color-text);
}

.prose pre {
  overflow-x: auto;
  padding: 1.1em 1.25em;
  border: 1px solid var(--color-line-soft);
  border-radius: 0.85rem;
  background: var(--color-surface-1);
  font-size: 0.875em;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.prose figure {
  margin-block: 2em;
}

.prose img {
  height: auto;
  border-radius: 1rem;
}

.prose figcaption {
  margin-top: 0.75em;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-subtle);
}

/* A video in an article (assets/js/video.js): a box in the film's proportions, showing the still
   frame and a play button; after the click the player takes the same box, so nothing moves. As
   wide as the text, or, for a film taller than wide, narrow and centred, so that it fits on a
   phone screen (at most 80% of the screen's height). --w, --h and aspect-ratio come from the build. */
.video-player {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--color-surface-1);
}

.prose__video--portrait .video-player {
  width: min(100%, calc(min(80vh, 44rem) * var(--w) / var(--h)));
  margin-inline: auto;
}

.prose__video--portrait figcaption {
  text-align: center;
}

.prose .video-player__start,
.video-player__video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.prose .video-player__start {
  color: #000;
  text-decoration: none;
}

.video-player__start[hidden] {
  display: none;
}

.prose .video-player__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.video-player__video {
  object-fit: contain;
  background: #000;
}

/* the play button: in the middle, large enough for a thumb, with the length and the size of the file */
.video-player__button {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  /* its own width (left: 50% would otherwise allow only half the box and squeeze the icon) */
  width: max-content;
  max-width: calc(100% - 1.5rem);
  grid-template-columns: 2rem auto;
  align-items: center;
  column-gap: 0.65rem;
  padding: 0.8rem 1.35rem 0.8rem 1rem;
  border-radius: 999px;
  background: var(--color-accent);
  box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 0.45);
  color: #000;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.video-player__icon {
  grid-row: span 2;
  width: 2rem;
  height: 2rem;
  fill: currentColor;
}

.video-player__label {
  font-weight: 600;
  line-height: 1.2;
}

.video-player__facts {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.3;
}

.prose .video-player__start:hover .video-player__button {
  background: #f7bd86;
  transform: translate(-50%, -50%) scale(1.04);
}

.prose .video-player__start:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
}

/* loading: the frame dims and the icon turns into a spinning ring */
.video-player.is-loading .video-player__poster {
  opacity: 0.6;
}

.video-player.is-loading .video-player__icon {
  border: 3px solid rgb(0 0 0 / 0.25);
  border-top-color: #000;
  border-radius: 50%;
  fill: none;
  animation: video-player-spin 0.8s linear infinite;
}

@keyframes video-player-spin {
  to {
    transform: rotate(360deg);
  }
}

/* the film could not be loaded: a message at the bottom of the box, with a direct link */
.video-player__status {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  left: 0.75rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: rgb(0 0 0 / 0.85);
  color: var(--color-text);
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .video-player__button {
    transition: none;
  }

  .video-player.is-loading .video-player__icon {
    animation-duration: 2.4s;
  }
}

.prose hr {
  height: 1px;
  margin-block: 2.5em;
  border: 0;
  background: var(--color-line);
}

.prose__table {
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: 0.6em 0.75em;
  border-bottom: 1px solid var(--color-line-soft);
  text-align: left;
  vertical-align: top;
}

.prose th {
  font-weight: 500;
  color: var(--color-text);
}

.prose :is(h2, h3, h4) {
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

/* ---- The time cost calculator (an HTML block in an article; assets/js/time-cost.js) ------------- */

.time-cost {
  margin-block: 2.25em;
  padding: clamp(1.25rem, 0.9rem + 1.5vw, 2rem);
  border: 1px solid var(--color-line);
  border-radius: 1.25rem;
  background: var(--color-surface-1);
}

.prose .time-cost__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.time-cost__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem 1.25rem;
  margin-top: 1.25rem;
}

.time-cost__field {
  display: grid;
  /* the label on top, the field at the bottom: fields in a row line up even when a label wraps */
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 0.45rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--color-text);
}

.time-cost__field input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 0.75rem;
  background: #09090a;
  color: var(--color-text);
  font: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.time-cost__field input:hover {
  border-color: rgb(255 255 255 / 0.35);
}

.time-cost__field input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.prose .time-cost__result {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-line-soft);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.prose .time-cost__result strong {
  color: var(--color-accent);
  font-weight: 500;
  white-space: nowrap;
}

.prose .time-cost__note {
  margin: 0.6rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-subtle);
}

@media (prefers-reduced-motion: reduce) {
  .time-cost__field input {
    transition: none;
  }
}

/* ---- After the article -------------------------------------------------------------------- */

.article__footer {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem) var(--section-space);
}

/* "O autorze": who wrote the article, as on the home page's "Kto za tym stoi" */
.author {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
  padding-top: clamp(2rem, 1.5rem + 2vw, 3rem);
  border-top: 1px solid var(--color-line);
}

.author__photo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
}

.author__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}

.author__name {
  margin-top: 0.35rem;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.25;
}

.author__role {
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-accent);
}

.author__bio {
  margin-top: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  text-wrap: pretty;
}

.author__link {
  display: inline-block;
  margin-top: 0.85rem;
}

@media (max-width: 479.98px) {
  .author {
    grid-template-columns: minmax(0, 1fr);
  }
}

.article-cta {
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  border: 1px solid var(--color-line-soft);
  border-radius: 1.5rem;
  background:
    radial-gradient(70% 60% at 100% 0%, var(--color-accent-glow), transparent 70%),
    var(--color-surface-2);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.07);
}

.article-cta__title {
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  font-weight: 400;
  font-variation-settings: "opsz" 32;
  line-height: 1.2;
  text-wrap: balance;
}

.article-cta__text {
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.article__more {
  margin-top: clamp(3rem, 2rem + 3vw, 4.5rem);
}

.article__more-title {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}

.article__back {
  margin-top: 2.5rem;
}

/* ---- 404 ---------------------------------------------------------------------------------------- */

.page--not-found main {
  display: grid;
  min-height: calc(100vh - var(--header-height));
  align-content: center;
}

.not-found__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 2.25rem;
}

.not-found__other {
  margin-top: 3rem;
  font-size: 0.875rem;
  color: var(--color-text-subtle);
}

/* ---- Focus on the shared pieces (sections.css only covers .section) ------------------------------ */

.page main :is(.button, .text-link):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* ---- Tablet and phone ------------------------------------------------------------------------- */

@media (max-width: 1023.98px) {
  .post-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-card article,
  .post-card__arrow,
  .prose a {
    transition: none;
  }
}
