/**
 * @file
 * Reusable components: buttons, pills, cards, block titles, messages, tabs,
 * breadcrumb, pager, nodes and comments.
 */

/* Buttons: green pill with navy text and a retro offset shadow. */
.button,
.button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.6rem 1.35rem;
  color: var(--hh-navy);
  background: var(--hh-cream);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius-pill);
  box-shadow: 3px 3px 0 var(--hh-navy);
  font: inherit;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
}

.button:hover {
  color: var(--hh-navy);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--hh-navy);
}

.button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--hh-navy);
}

.button--primary,
.button--primary:visited {
  background: var(--hh-green);
  box-shadow: 3px 3px 0 var(--hh-russet);
}

.button--primary:hover {
  box-shadow: 5px 5px 0 var(--hh-russet);
}

.button--danger {
  color: #fff;
  background: var(--hh-red);
}

.button--danger:hover {
  color: #fff;
}

.button--ghost,
.button--ghost:visited {
  color: var(--hh-cream);
  background: transparent;
  border-color: rgb(255 244 221 / 55%);
  box-shadow: none;
}

.button--ghost:hover {
  color: var(--hh-navy);
  background: var(--hh-cream);
  border-color: var(--hh-cream);
  box-shadow: 3px 3px 0 var(--hh-russet);
}

.button--small {
  min-height: 2.25rem;
  padding: 0.35rem 0.95rem;
  font-size: var(--fs-sm);
}

.button:disabled,
.button.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Pills, eyebrows and chips */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.pill--green {
  color: var(--hh-navy);
  background: var(--hh-green);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.9rem 0.35rem 0.75rem;
  color: var(--hh-green);
  background: rgb(143 225 75 / 10%);
  border: 1px solid rgb(143 225 75 / 35%);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow--dark {
  color: var(--hh-russet-dark);
  background: rgb(184 93 49 / 8%);
  border-color: rgb(184 93 49 / 30%);
}

@media (prefers-color-scheme: dark) {
  .eyebrow--dark {
    color: var(--hh-tan);
    background: rgb(228 173 104 / 10%);
    border-color: rgb(228 173 104 / 30%);
  }
}

.pulse-dot {
  position: relative;
  width: 0.55rem;
  height: 0.55rem;
  flex: none;
  background: currentColor;
  border-radius: 50%;
}

.pill--green .pulse-dot {
  background: var(--hh-green-dark);
}

@media (prefers-reduced-motion: no-preference) {
  .pulse-dot::after {
    position: absolute;
    inset: 0;
    content: "";
    border-radius: 50%;
    box-shadow: 0 0 0 0 currentColor;
    animation: hhk-pulse 2.2s ease-out infinite;
  }
}

@media (max-width: 29.99rem) {
  .eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.01em;
  }
}

@keyframes hhk-pulse {
  0% { box-shadow: 0 0 0 0 rgb(143 225 75 / 70%); }
  80%, 100% { box-shadow: 0 0 0 0.6rem rgb(143 225 75 / 0%); }
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem 0.3rem 0.4rem;
  color: var(--hh-navy);
  background: var(--hh-cream);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius-pill);
  box-shadow: 3px 3px 0 rgb(0 0 0 / 35%);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Pass / warn / fail icons: a coloured disc with a cream glyph masked on top.
   Chips draw the disc with ::before and the glyph with ::after. */
.chip--pass,
.state-icon--pass { --state-c: var(--hh-green-dark); --state-glyph: url(../images/icons/check.svg); }
.chip--fail,
.state-icon--fail { --state-c: var(--hh-red); --state-glyph: url(../images/icons/cross.svg); }
.chip--warn,
.state-icon--warn { --state-c: #c47a1d; --state-glyph: url(../images/icons/warn.svg); }

.chip::before {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  content: "";
  background: var(--state-c);
  border-radius: 50%;
}

.chip::after {
  position: absolute;
  top: 50%;
  left: calc(0.4rem + 0.2rem);
  width: 0.75rem;
  height: 0.75rem;
  margin-top: -0.375rem;
  content: "";
  background: var(--hh-cream);
  -webkit-mask: var(--state-glyph) center / contain no-repeat;
  mask: var(--state-glyph) center / contain no-repeat;
}

.state-icon {
  position: relative;
  display: inline-block;
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
  background: var(--state-c);
  border-radius: 50%;
  vertical-align: middle;
}

.state-icon::after {
  position: absolute;
  inset: 22%;
  content: "";
  background: var(--hh-cream);
  -webkit-mask: var(--state-glyph) center / contain no-repeat;
  mask: var(--state-glyph) center / contain no-repeat;
}

/* Cards */
.card {
  position: relative;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--c-raised);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-retro);
}

@media (prefers-color-scheme: dark) {
  .card {
    border-color: var(--c-border-strong);
  }
}

/* Generic block titles: Jethro's "headline", rebranded. */
.block__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.block__title::before {
  width: 1.4rem;
  height: 4px;
  flex: none;
  content: "";
  background: var(--hh-green);
  border-radius: 2px;
  box-shadow: 0 4px 0 var(--hh-russet);
}

.layout__sidebar .block {
  padding: 1.25rem;
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.layout__sidebar ul {
  padding-inline-start: 1.1rem;
}

/* Page title with the swash underline from the wordmark. */
.region--content-above {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.page-title,
.block-page-title-block h1 {
  margin: 0;
  font-size: var(--fs-h1);
}

.swash,
.block-page-title-block h1 {
  position: relative;
  padding-bottom: 0.4em;
}

.swash::after,
.block-page-title-block h1::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: min(7rem, 60%);
  height: 0.28em;
  max-height: 10px;
  content: "";
  background: var(--hh-green);
  border-radius: 0 0 999px 999px / 0 0 100% 100%;
  box-shadow: 0 3px 0 var(--hh-russet);
}

.section-head .swash::after {
  left: 50%;
  transform: translateX(-50%);
}

/* Status messages, styled as response codes. */
.messages-list {
  display: grid;
  gap: 0.75rem;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  color: var(--hh-navy);
  background: var(--msg-bg);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--msg-c);
}

.message--status { --msg-c: var(--hh-green-dark); --msg-bg: #effbe4; }
.message--warning { --msg-c: #c47a1d; --msg-bg: #fff3dc; }
.message--error { --msg-c: var(--hh-red); --msg-bg: #fde9e4; }
.message--info { --msg-c: var(--hh-navy-soft); --msg-bg: #e8f0fa; }

.message__code {
  flex: none;
  padding: 0.15rem 0.5rem;
  color: #fff;
  background: var(--msg-c);
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
}

.message__body {
  min-width: 0;
  padding-top: 0.05rem;
}

.message a {
  color: var(--hh-russet-dark);
}

.message__list {
  margin: 0;
  padding-inline-start: 1.1rem;
}

/* Tabs (local tasks) as a segmented control. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
}

.tabs a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--c-text);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 650;
  text-decoration: none;
}

.tabs a:hover {
  background: var(--c-code-bg);
}

.tabs .is-active a,
.tabs a.is-active {
  color: var(--hh-cream);
  background: var(--hh-navy);
}

@media (prefers-color-scheme: dark) {
  .tabs .is-active a,
  .tabs a.is-active {
    color: var(--hh-navy);
    background: var(--hh-green);
  }
}

.tabs--secondary {
  padding: 0.2rem;
}

/* Local actions ("+ Add content"). */
.action-links,
.block-local-actions-block ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.action-links a,
.block-local-actions-block a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 1rem;
  color: var(--hh-navy);
  background: var(--hh-green);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
}

/* Breadcrumb, styled as a request path: ~/ section / page */
.breadcrumb {
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--c-text-muted);
}

.breadcrumb__list::before {
  margin-inline-end: 0.4rem;
  content: "~/";
  color: var(--c-pass);
  font-weight: 700;
}

.breadcrumb__item + .breadcrumb__item::before {
  margin-inline: 0.45rem;
  content: "/";
  color: var(--c-border-strong);
}

.breadcrumb a {
  color: var(--c-text);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--c-link);
  text-decoration: underline;
}

/* Pager */
.pager {
  margin-top: 2.5rem;
}

.pager__items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager__item a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  height: 2.6rem;
  padding-inline: 0.75rem;
  color: var(--c-text);
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  font-weight: 650;
  text-decoration: none;
}

.pager__item a:hover {
  border-color: var(--hh-navy);
}

.pager__item.is-active a {
  color: var(--hh-navy);
  background: var(--hh-green);
  border: 2px solid var(--hh-navy);
}

.pager__item--ellipsis {
  align-self: center;
  color: var(--c-text-muted);
}

/* Nodes */
.node--view-mode-full .node__meta,
.node__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

.node__meta img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
}

.node--unpublished {
  outline: 3px dashed var(--hh-tan);
  outline-offset: 6px;
}

/* Teasers become cards in a responsive grid. */
.node--view-mode-teaser {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.node--view-mode-teaser:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--hh-russet);
}

.node--view-mode-teaser .node__title {
  margin-bottom: 0.4rem;
  font-size: var(--fs-h3);
}

.node--view-mode-teaser .node__title a {
  color: var(--c-heading);
  text-decoration: none;
}

/* The whole card is clickable through the title link. */
.node--view-mode-teaser .node__title a::after {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: inherit;
}

.node--view-mode-teaser .node__meta {
  margin-bottom: 0.75rem;
}

.node--view-mode-teaser .node__content {
  color: var(--c-text-muted);
}

.node--view-mode-teaser .node__content > :last-child,
.node--view-mode-teaser .node__content p:last-child {
  margin-bottom: 0;
}

.node--view-mode-teaser .links {
  position: relative;
  z-index: 1;
  margin: auto 0 0;
  padding: 1rem 0 0;
  list-style: none;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.node--view-mode-teaser .links a::after {
  content: " →";
}

.node--sticky::before {
  position: absolute;
  top: -0.8rem;
  right: 1.25rem;
  padding: 0.1rem 0.6rem;
  content: "pinned";
  color: var(--hh-navy);
  background: var(--hh-tan);
  border: 2px solid var(--hh-navy);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Views rows of teasers form a grid. */
.views-element-container .view-content:has(> div > .node--view-mode-teaser),
.view-content:has(> div > .node--view-mode-teaser) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1.75rem;
}

.feed-icon {
  display: inline-flex;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

/* Inline field labels and lists */
.field__label {
  font-weight: 750;
}

.field--label-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.field--label-inline .field__label::after {
  content: ":";
}

/* Comments */
.comment {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--hh-tan);
  border-radius: var(--radius);
}

.comment__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

.comment__submitted {
  margin: 0;
}

.comment__title {
  font-size: var(--fs-lg);
}

.comment .links,
.node .links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}

.comment--unpublished {
  border-left-color: var(--hh-red);
}

/* Empty-state text from views ("No front page content…"). */
.view-empty {
  padding: 2rem;
  background: var(--c-raised);
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}
