/*
 * Capt. Mike's: base stylesheet.
 *
 * Reset, type, grounds, grid, buttons and small utilities shared by every
 * block. Every colour, font and size comes from brand.css. Block stylesheets
 * never redefine anything here.
 */


/* ---------- reset ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cm-bone);
  color: var(--cm-ink);
  font-family: var(--cm-font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
figure, blockquote { margin: 0; }
a { color: inherit; }
button { font: inherit; }

/* ---------- type ---------- */

h1, h2, .cm-display {
  margin: 0;
  font-family: var(--cm-display);
  font-style: italic;
  font-weight: 700;
  line-height: .94;
  letter-spacing: 0;
  text-transform: uppercase;
  text-wrap: balance;
}

h1 { font-size: clamp(56px, 8vw, 128px); }
h2 { font-size: clamp(46px, 5.4vw, 84px); }

h3 {
  margin: 0;
  font-family: var(--cm-display);
  font-weight: 700;
  font-size: clamp(24px, 2.2vw, 30px);
  line-height: 1.05;
  letter-spacing: .005em;
  text-transform: uppercase;
}

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.cm-line { display: block; }

/* Payoff phrase, written *like this* in a headline field. */
.cm-hl { font-style: inherit; }
.cm-ink .cm-hl { color: var(--cm-yellow); }
.cm-bone .cm-hl {
  padding: 0 .1em;
  /* Barlow's line box is taller than its capitals: trim the block to the letters. */
  background: linear-gradient(transparent 14%, var(--cm-yellow) 14%, var(--cm-yellow) 94%, transparent 94%);
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
}

.cm-lead { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.5; max-width: 44ch; }
.cm-copy { max-width: 60ch; }

.cm-label {
  display: block;
  font-family: var(--cm-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* ---------- grounds ---------- */

.cm-ink { background: var(--cm-ink); color: var(--cm-bone); }
.cm-ink .cm-lead, .cm-ink .cm-copy { color: var(--cm-muted-dark); }
.cm-ink .cm-label { color: var(--cm-yellow); }

.cm-bone { background: var(--cm-bone); color: var(--cm-ink); }
.cm-bone .cm-lead, .cm-bone .cm-copy { color: var(--cm-muted); }
.cm-bone .cm-label { color: var(--cm-muted); }

/* ---------- layout ---------- */

.cm-wrap {
  width: 100%;
  max-width: var(--cm-wrap);
  margin: 0 auto;
  padding: 0 var(--cm-gutter);
}

.cm-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--cm-gap);
}

.cm-block { position: relative; }
.cm-section { padding: clamp(80px, 9vw, 128px) 0; }

/* ---------- buttons and links ---------- */

.cm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 58px;
  padding: 0 30px;
  border: 0;
  border-radius: 0;
  background: var(--cm-yellow);
  color: var(--cm-ink);
  font-family: var(--cm-display);
  font-style: italic;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s var(--cm-ease), color .2s var(--cm-ease), transform .2s var(--cm-ease);
}
.cm-btn .cm-icon { width: 20px; height: 20px; }
.cm-btn:hover { background: var(--cm-white); }
.cm-bone .cm-btn:hover { background: var(--cm-ink); color: var(--cm-yellow); }
.cm-btn:active { transform: translateY(2px); }

/* Ink button, for use on a yellow panel. */
.cm-btn--ink { background: var(--cm-ink); color: var(--cm-yellow); }
.cm-btn--ink:hover { background: var(--cm-white); color: var(--cm-ink); }

.cm-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 3px;
  border-bottom: 3px solid var(--cm-yellow);
  font-family: var(--cm-display);
  font-style: italic;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .02em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color .2s var(--cm-ease);
}
.cm-link .cm-icon { width: 18px; height: 18px; }
.cm-link:hover { border-color: currentColor; }
.cm-bone .cm-link { border-color: var(--cm-ink); }
.cm-bone .cm-link:hover { border-color: var(--cm-yellow); }

.cm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 32px;
}

/* ---------- media and small pieces ---------- */

.cm-frame {
  position: relative;
  overflow: hidden;
  background: var(--cm-ink-2);
}
.cm-frame img { width: 100%; height: 100%; object-fit: cover; }

.cm-icon { width: 20px; height: 20px; flex: none; fill: currentColor; }

/* Halftone dots, a sparse print accent. Placed by the block that uses it. */
.cm-dots {
  position: absolute;
  width: 260px;
  height: 260px;
  background-size: 10px 10px;
  -webkit-mask-image: radial-gradient(circle at center, #000 0%, transparent 70%);
          mask-image: radial-gradient(circle at center, #000 0%, transparent 70%);
  pointer-events: none;
}
.cm-dots--ink { background-image: var(--cm-dots-ink); }
.cm-dots--yellow { background-image: var(--cm-dots-yellow); }

/* ---------- accessibility ---------- */

.cm-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.cm-skip {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 100;
  padding: 14px 20px;
  background: var(--cm-yellow);
  color: var(--cm-ink);
  font-weight: 700;
  text-decoration: none;
}
.cm-skip:focus { top: 16px; }

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

@media (max-width: 640px) {
  body { font-size: 16px; }
  .cm-actions .cm-btn { width: 100%; }
}

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

/* ---------- WordPress ---------- */

/* Template parts wrap the header in a div, which would pin the sticky header
   to a 84px-tall box. display: contents lets it stick to the page instead. */
.wp-block-template-part:has(> .cm-header) { display: contents; }
.admin-bar .cm-header { top: var(--wp-admin--admin-bar--height, 0px); }

/* Sections butt up against each other; no block gap between them. */
.wp-site-blocks > *,
.wp-block-post-content > * { margin-block: 0; }

/* The blog templates use these two. */
.cm-eyebrow {
  display: block;
  font-family: var(--cm-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cm-muted);
}
.cm-rule { width: 64px; height: 4px; margin: 24px 0; border: 0; background: var(--cm-yellow); }
