/* Reusable pieces shared by blocks, the blog and the chrome. */

/* ---- Buttons ------------------------------------------------------- */
.btn {
  --btn-pad: .78em 1.5em;
  display: inline-flex; align-items: center; gap: .5em;
  padding: var(--btn-pad);
  font-family: var(--font-display); font-size: var(--step-1);
  letter-spacing: .06em; text-transform: uppercase; line-height: 1;
  text-decoration: none; cursor: pointer;
  border: calc(var(--border) * 1px) solid var(--ink);
  border-radius: calc(var(--radius) * 1px);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn--solid { background: var(--ink); color: var(--bone); }
.btn--solid:hover, .btn--solid:focus-visible { background: var(--deep); border-color: var(--deep); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--bone); }
.btn--ghost:hover, .btn--ghost:focus-visible { background: var(--ink); color: var(--bone); transform: translateY(-2px); }
.btn--small { --btn-pad: .55em 1.1em; font-size: var(--step-0); }

/* ---- Grid ---------------------------------------------------------- */
.grid { display: grid; gap: clamp(18px, 2.4vw, 32px); list-style: none; margin: 0; padding: 0; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); } }

/* ---- Tile ---------------------------------------------------------- */
.tile {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel);
  border: calc(var(--border) * 1px) solid var(--line);
  border-radius: calc(var(--radius) * 1px);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tile:hover { border-color: var(--ink); transform: translateY(-3px); }
.tile__img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.tile__link-block { display: flex; flex-direction: column; color: inherit; text-decoration: none; height: 100%; }
.tile__body { display: flex; flex-direction: column; gap: 10px; padding: clamp(16px, 2vw, 26px); }
.tile__title { margin: 0; font-family: var(--font-display); font-size: var(--step-2); line-height: 1.05; letter-spacing: .01em; }
.tile__text { margin: 0; color: var(--muted); }
.tile__meta { margin: auto 0 0; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tile__link { margin-top: auto; align-self: flex-start; color: var(--ink); font-family: var(--font-mono); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; }
.tile__link:hover { text-decoration: underline; }

/* ---- Figures ------------------------------------------------------- */
.figure { margin: 0; }
.figure__img { display: block; width: 100%; height: auto; border-radius: calc(var(--radius) * 1px); }
.figure__caption { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }

/* ---- Embedded players ---------------------------------------------- */
.ratio { position: relative; width: 100%; background: var(--panel-2); border-radius: calc(var(--radius) * 1px); overflow: hidden; }
.ratio--16x9 { aspect-ratio: 16 / 9; }
.ratio__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Prose --------------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font-display); line-height: 1.08; letter-spacing: .01em; }
.prose h2 { font-size: var(--step-2); }
.prose h3 { font-size: var(--step-1); }
.prose a { color: var(--ink); text-underline-offset: .18em; }
.prose img { max-width: 100%; height: auto; border-radius: calc(var(--radius) * 1px); }
.prose blockquote {
  margin-inline: 0; padding: .2em 0 .2em 1.1em;
  border-left: 3px solid var(--ink); color: var(--bone); font-size: var(--step-1);
}
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--panel-2); padding: .12em .4em; }
.prose pre { background: var(--panel-2); padding: 1em; overflow-x: auto; border-left: 3px solid var(--ink); }
.prose pre code { background: none; padding: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5em .7em; text-align: left; }

/* ---- Forms --------------------------------------------------------- */
.form { max-width: 46rem; }
.form__row { display: grid; gap: 7px; margin: 0 0 18px; }
.form__row--trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__label { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.form__input {
  width: 100%; padding: .8em 1em; color: var(--bone); font: inherit;
  background: var(--panel-2);
  border: calc(var(--border) * 1px) solid var(--line);
  border-radius: calc(var(--radius) * 1px);
}
.form__input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-color: var(--ink); }
.form__input--area { resize: vertical; min-height: 9em; }
.form__actions { margin: 26px 0 0; }

/* ---- Notices ------------------------------------------------------- */
.notice {
  margin: 0 0 22px; padding: 14px 18px; list-style: none;
  border-left: 3px solid var(--ink); background: var(--panel);
}
.notice--good { border-left-color: #35B37E; }
.notice--bad { border-left-color: var(--ink); color: var(--bone); }
.notice li + li { margin-top: 6px; }

/* ---- Preview banner ------------------------------------------------ */
.preview-bar {
  margin: 0; padding: 12px var(--gutter);
  background: var(--deep); color: var(--bone);
  font-family: var(--font-mono); font-size: .82rem;
  letter-spacing: .12em; text-transform: uppercase; text-align: center;
}

/* ---- Error / empty states ------------------------------------------ */
.error-page {
  width: min(100% - var(--gutter) * 2, 44rem);
  margin-inline: auto;
  padding-block: clamp(80px, 14vw, 180px);
  text-align: center;
}
.error-page__code {
  margin: 0; color: var(--ink);
  font-family: var(--font-display); font-size: var(--step-4);
  line-height: 1; letter-spacing: .04em; text-transform: uppercase;
}
.error-page__title {
  margin: .2em 0 .4em;
  font-family: var(--font-display); font-size: var(--step-3);
  line-height: 1; text-transform: uppercase;
}
.error-page__body { margin: 0 0 1.8em; color: var(--muted); font-size: var(--step-1); }
