/* ==========================================================================
   Sticker Slab — Base / Reset
   ========================================================================== */

/* Self-hosted webfonts.
   Files ship with the theme in assets/fonts/ and are preloaded from
   default.hbs so they're in flight before this CSS is even parsed.
   font-display: block hides text for up to 3s while the font loads
   — with preload, the font almost always arrives first, so no fallback
   render ever hits the screen. If it does slip through, the "Fallback"
   families below are metric-matched so there's no reflow. */
@font-face {
  font-family: "ITC Lubalin Graph Std Demi";
  src: url("../fonts/ITC-Lubalin-Graph-Std-Demi.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-Bold.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: block;
}

/* Metric-matched fallback fonts.
   These wrap the OS's Georgia/Arial with size-adjust + ascent/descent
   overrides so the fallback's boxes match the custom font's boxes.
   The 3s block window from font-display: block should almost always
   deliver the real font first — but if it doesn't, this makes the
   swap nearly invisible instead of a full reflow. */
@font-face {
  font-family: "Lubalin Fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 108%;
  ascent-override: 88%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("Helvetica");
  size-adjust: 108.1%;
  ascent-override: 85.7%;
  descent-override: 22.2%;
  line-gap-override: 0%;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ts-font-body);
  font-size: var(--ts-fs-md);
  font-weight: 500;
  line-height: 1.6;
  color: var(--ts-ink);
  background-color: var(--ts-bg);
  background-image: url("../images/background-texture.webp");
  background-repeat: repeat;
  background-size: 512px 512px;
  background-position: 0 0;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

figure { margin: 0; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: 0; padding: 0; }

a {
  color: var(--ts-accent-1);
  text-decoration: none;
  transition: color var(--ts-t-fast) var(--ts-ease);
}
a:hover { color: var(--ts-ink); }

:focus-visible {
  outline: 3px solid var(--ts-accent-1);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ts-font-heading);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ts-ink);
  margin: 0 0 var(--ts-space-4);
}

h1 { font-size: var(--ts-fs-4xl); }
h2 { font-size: var(--ts-fs-3xl); }
h3 { font-size: var(--ts-fs-2xl); }
h4 { font-size: var(--ts-fs-xl); }
h5 { font-size: var(--ts-fs-lg); }
h6 { font-size: var(--ts-fs-md); text-transform: uppercase; letter-spacing: 0.05em; }

p { margin: 0 0 var(--ts-space-4); }

/* Inline elements */
strong, b { font-weight: 700; }
em, i { font-style: italic; }

/* Regular-weight zones. Body defaults to Medium (500) — these
   utility contexts drop back to Regular (400). The article author
   name inside .post-*-meta stays bold via the <strong> wrapper. */
.site-footer,
.post-hero__meta,
.post-card__meta { font-weight: 400; }

code, kbd, samp, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  font-size: 0.95em;
}

code {
  padding: 0.15em 0.4em;
  background: var(--ts-surface);
  border: 1px solid var(--ts-ink-line);
  border-radius: var(--ts-radius-sm);
}

pre {
  padding: var(--ts-space-4);
  background: var(--ts-surface);
  border: var(--ts-border-w) solid var(--ts-ink);
  border-radius: var(--ts-radius);
  box-shadow: var(--ts-shadow-sticker);
  overflow-x: auto;
  margin: 0 0 var(--ts-space-5);
}
pre code { padding: 0; background: transparent; border: 0; }

blockquote {
  margin: var(--ts-space-5) 0;
  padding: var(--ts-space-4) var(--ts-space-5);
  border-left: var(--ts-border-w) solid var(--ts-accent-1);
  background: var(--ts-surface);
  border-radius: 0 var(--ts-radius) var(--ts-radius) 0;
  font-style: italic;
  font-size: var(--ts-fs-lg);
}

hr {
  border: 0;
  border-top: var(--ts-border-w) solid var(--ts-ink);
  margin: var(--ts-space-6) 0;
}

/* Prose lists only. Scoped so UI lists (nav, sidebar, etc.) can lay out
   cleanly without inheriting a bottom margin that throws off flex/grid
   centering. */
.gh-content ul,
.gh-content ol,
.post-content ul,
.post-content ol {
  margin: 0 0 var(--ts-space-4);
  padding-left: var(--ts-space-5);
}
.gh-content li,
.post-content li { margin-bottom: var(--ts-space-2); }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--ts-space-5);
  border: var(--ts-border-w) solid var(--ts-ink);
  border-radius: var(--ts-radius);
  overflow: hidden;
  background: var(--ts-surface);
}
th, td {
  padding: var(--ts-space-3) var(--ts-space-4);
  text-align: left;
  border-bottom: 1px solid var(--ts-ink-line);
}
th { font-family: var(--ts-font-heading); background: var(--ts-bg); }
tr:last-child td { border-bottom: 0; }

/* Form defaults */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: var(--ts-space-3) var(--ts-space-4);
  border: var(--ts-border-w) solid var(--ts-ink);
  border-radius: var(--ts-radius-pill);
  background: var(--ts-surface);
  color: var(--ts-ink);
  transition: box-shadow var(--ts-t-fast) var(--ts-ease),
              transform var(--ts-t-fast) var(--ts-ease);
}
textarea {
  border-radius: var(--ts-radius);
  resize: vertical;
  min-height: 8rem;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--ts-shadow-sticker);
}

::placeholder { color: var(--ts-ink-mute); }

/* Screen reader only */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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