/* Ported components. Selectors stay at single-class specificity; no !important. */

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-family: var(--font-sans);
  font-size: var(--type-ui-label-size);
  font-weight: var(--type-ui-label-weight);
  line-height: var(--type-ui-label-leading);
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--motion-base) var(--motion-easing),
    color var(--motion-base) var(--motion-easing),
    border-color var(--motion-base) var(--motion-easing),
    transform var(--motion-fast) var(--motion-easing);
}
.btn:active { transform: scale(var(--motion-press-scale)); }

.btn--primary {
  background: var(--action-primary-bg);
  color: var(--action-primary-fg);
  padding: 12px 24px;
  min-height: var(--target-min);
}
.btn--primary:hover { background: var(--action-primary-bg-hover); }

.btn--secondary {
  background: transparent;
  color: var(--action-secondary-fg);
  border: 1.5px solid var(--action-secondary-border);
  padding: 12px 24px;
  min-height: var(--target-min);
}
.btn--secondary:hover { background: var(--action-secondary-wash); }

.btn--outline-on-hero {
  background: var(--action-on-hero-fill);
  color: var(--text-on-dark);
  border: 1.5px solid var(--action-on-hero-border);
  padding: 14px 28px;
  min-height: 48px;
}
.btn--outline-on-hero:hover { background: rgb(255 255 255 / .16); }
.btn--outline-on-hero:focus-visible { outline-color: var(--focus-on-dark); }

.btn--outline-on-bright {
  background: transparent;
  color: var(--text-body);
  border: 1.5px solid var(--ink);
  padding: 14px 28px;
  min-height: 48px;
}
.btn--outline-on-bright:hover { background: rgb(27 38 51 / .06); }

/* ---------- Text links ---------- */

.text-link {
  color: var(--text-link);
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-leading);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-thickness var(--motion-fast) var(--motion-easing);
}
.text-link:hover { text-decoration-thickness: 2px; }
.text-link--on-dark {
  color: var(--text-link-on-dark);
}
.text-link--on-dark:focus-visible { outline-color: var(--focus-on-dark); }

/* ---------- Tag chip ---------- */

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  background: var(--surface-card-warm);
  color: var(--text-muted);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-leading);
}

/* ---------- Project card ---------- */

.project-card {
  display: block;
  text-decoration: none;
  color: var(--text-body);
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: var(--layout-card-padding);
  transition: border-color var(--motion-base) var(--motion-easing);
}
@media (max-width: 640px) {
  .project-card { padding: var(--layout-card-padding-mobile); }
}
.project-card:hover,
.project-card:focus-visible {
  border-color: var(--text-link);
}
.project-card--warm { background: var(--surface-card-warm); }

.project-card__image {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-card-warm);
  aspect-ratio: 16 / 10;
}
.project-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--motion-slow) var(--motion-easing);
}
.project-card:hover .project-card__image img,
.project-card:focus-visible .project-card__image img {
  transform: scale(1.02);
}

.project-card__role {
  margin-top: var(--space-md);
  font-family: var(--font-sans);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-strong-weight);
  line-height: var(--type-caption-strong-leading);
  color: var(--text-muted);
}

.project-card__title {
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-sans-structure);
  font-size: var(--type-heading-md-size);
  font-weight: var(--type-heading-md-weight);
  line-height: var(--type-heading-md-leading);
  letter-spacing: var(--type-heading-md-tracking);
  text-underline-offset: 0.14em;
}
@media (max-width: 640px) {
  .project-card__title { font-size: var(--type-heading-md-size-mobile); }
}
.project-card:hover .project-card__title,
.project-card:focus-visible .project-card__title {
  text-decoration: underline;
}

.project-card__outcome {
  margin-top: var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-leading);
  color: var(--text-muted);
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.icon-external {
  flex: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ---------- Global nav ---------- */

.global-nav {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  height: var(--layout-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--space-lg);
  background: var(--surface-page);
  color: var(--text-body);
  transition:
    background-color var(--motion-base) var(--motion-easing),
    color var(--motion-base) var(--motion-easing);
}
.global-nav--transparent {
  background: transparent;
  color: var(--text-on-dark);
}
.global-nav.is-scrolled {
  background: var(--frosted-bg);
  backdrop-filter: var(--frosted-filter);
  -webkit-backdrop-filter: var(--frosted-filter);
  color: var(--text-body);
}
.global-nav.is-scrolled :focus-visible { outline-color: var(--focus); }
.global-nav--transparent:not(.is-scrolled) :focus-visible { outline-color: var(--focus-on-dark); }

.global-nav__brand {
  font-family: var(--font-serif-display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.015em;
  color: inherit;
  text-decoration: none;
}

.global-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.global-nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  font-family: var(--font-sans);
  font-size: var(--type-nav-size);
  font-weight: var(--type-nav-weight);
  line-height: var(--type-nav-leading);
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.4em;
  text-decoration-thickness: 1.5px;
}
.global-nav__links a[aria-current="page"] {
  text-decoration: underline;
}

.global-nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--target-min);
  height: var(--target-min);
  color: inherit;
  cursor: pointer;
}
.global-nav__toggle svg { stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; fill: none; }

@media (max-width: 640px) {
  .global-nav__toggle { display: inline-flex; }
  .global-nav__links {
    position: fixed;
    top: var(--layout-nav-height);
    left: 0;
    right: 0;
    z-index: 49;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--frosted-bg);
    backdrop-filter: var(--frosted-filter);
    -webkit-backdrop-filter: var(--frosted-filter);
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
    color: var(--text-body);
  }
  .global-nav.is-open .global-nav__links { display: flex; }
  .global-nav__links a { width: 100%; }
}

/* ---------- Site footer ---------- */

.site-footer {
  background: var(--surface-card-warm);
  color: var(--text-muted);
  padding: 64px var(--space-lg);
}
.site-footer__inner {
  max-width: var(--layout-content-max);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xl);
  justify-content: space-between;
  align-items: flex-start;
}
.site-footer__brand {
  max-width: var(--layout-measure-min);
}
.site-footer__wordmark {
  font-family: var(--font-serif-display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text-body);
}
.site-footer__note {
  margin-top: var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--type-fine-size);
  line-height: var(--type-fine-leading);
}
.site-footer__links {
  display: grid;
  gap: var(--space-xs);
}
.site-footer__links li {
  display: flex;
  align-items: center;
  min-height: var(--target-min);
}
.site-footer__links .text-link {
  font-size: var(--type-caption-size);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}
.site-footer__colophon {
  max-width: var(--layout-content-max);
  margin: var(--space-xl) auto 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-divider);
  font-family: var(--font-sans);
  font-size: var(--type-fine-size);
  line-height: var(--type-fine-leading);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

/* ---------- Grain hero (recipe A — at most once per site) ---------- */

.grain-hero {
  position: relative;
  isolation: isolate;
  min-height: 88vh;
  display: flex;
  align-items: center;
  border-radius: var(--radius-none);
  overflow: hidden;
  background-image:
    radial-gradient(86% 72% at 4% 0%, rgb(8 44 69 / .92) 0%, rgb(8 44 69 / .55) 42%, rgb(8 44 69 / 0) 68%),
    linear-gradient(90deg, rgb(12 22 32 / .62) 0%, rgb(12 22 32 / .30) 44%, rgb(12 22 32 / 0) 74%),
    linear-gradient(200deg, rgb(12 62 96 / .85) 0%, rgb(12 62 96 / .40) 36%, rgb(12 62 96 / 0) 62%),
    radial-gradient(95% 105% at 94% 2%, var(--ocean-dark) 0%, rgb(8 44 69 / 0) 64%),
    radial-gradient(96% 84% at 34% 8%, var(--peach) 0%, rgb(245 182 168 / 0) 54%),
    radial-gradient(78% 66% at 6% 74%, var(--berry) 0%, rgb(197 60 90 / 0) 60%),
    radial-gradient(70% 60% at 48% 60%, var(--blue-glow) 0%, rgb(77 130 180 / 0) 62%),
    radial-gradient(60% 55% at 64% 90%, var(--hot-coral) 0%, rgb(248 97 70 / 0) 60%),
    radial-gradient(55% 50% at 90% 96%, var(--tangerine) 0%, rgb(249 156 60 / 0) 58%),
    linear-gradient(180deg, var(--lilac), var(--coral));
}

.grain-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: var(--grain-tile) var(--grain-tile);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}

.grain-hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--layout-content-max);
  margin-inline: auto;
  padding: 120px var(--space-lg) var(--space-section);
}
@media (max-width: 640px) {
  .grain-hero__content { padding: 96px var(--space-lg) var(--space-section-mobile); }
}

.grain-hero__eyebrow {
  font-family: var(--font-sans);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-strong-weight);
  color: var(--text-on-dark-muted);
}

.grain-hero__title {
  margin-top: var(--space-md);
  max-width: 820px;
  font-family: var(--font-serif-display);
  font-size: var(--type-hero-size);
  font-weight: var(--type-hero-weight);
  line-height: var(--type-hero-leading);
  letter-spacing: var(--type-hero-tracking);
  color: var(--text-on-dark);
}
@media (max-width: 640px) {
  .grain-hero__title { font-size: var(--type-hero-size-mobile); }
}

.grain-hero__lead {
  margin-top: var(--space-lg);
  max-width: 620px;
  font-family: var(--font-sans);
  font-size: var(--type-lead-size);
  line-height: var(--type-lead-leading);
  letter-spacing: var(--type-lead-tracking);
  color: var(--text-on-dark);
}
@media (max-width: 640px) {
  .grain-hero__lead { font-size: var(--type-lead-size-mobile); }
}

.grain-hero__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* ---------- Aura inset (recipe B — at most once more per page) ---------- */

.aura-inset {
  background: var(--surface-page);
  padding: var(--space-section-mobile) var(--space-lg);
}
@media (min-width: 641px) { .aura-inset { padding: var(--space-section-tablet) var(--space-lg); } }
@media (min-width: 1024px) { .aura-inset { padding: var(--space-section) var(--space-lg); } }

.aura-inset__field {
  max-width: var(--layout-content-max);
  margin-inline: auto;
  min-height: 360px;
  border-radius: var(--radius-none);
  background-image:
    radial-gradient(60% 70% at 26% 34%, var(--coral) 0%, rgb(245 142 90 / 0) 62%),
    radial-gradient(55% 65% at 62% 26%, var(--peach) 0%, rgb(245 182 168 / 0) 64%),
    radial-gradient(70% 75% at 74% 72%, var(--lilac) 0%, rgb(223 197 226 / 0) 66%),
    radial-gradient(45% 55% at 12% 84%, var(--violet) 0%, rgb(147 127 167 / 0) 62%),
    linear-gradient(160deg, var(--paper), var(--shell));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl);
}

.aura-inset__statement {
  max-width: 560px;
  font-family: var(--font-serif-display);
  font-size: var(--type-accent-size);
  font-weight: var(--type-accent-weight);
  line-height: var(--type-accent-leading);
  letter-spacing: var(--type-accent-tracking);
  color: var(--ink);
}
@media (max-width: 640px) {
  .aura-inset__statement { font-size: var(--type-accent-size-mobile); }
}
.aura-inset__statement--narrow { max-width: 520px; }

/* ---------- Figure caption ---------- */

.figure-caption {
  margin-top: var(--space-sm);
  max-width: var(--layout-measure-max);
  font-family: var(--font-sans);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-leading);
  color: var(--text-muted);
}

/* ---------- Case study sub-nav (defined, unused — no case study page yet) ---------- */
/*
.case-study-sub-nav {
  position: sticky;
  top: var(--layout-nav-height);
  z-index: 40;
  height: var(--layout-subnav-height);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-inline: var(--space-lg);
  background: var(--frosted-bg);
  backdrop-filter: var(--frosted-filter);
  -webkit-backdrop-filter: var(--frosted-filter);
  font-family: var(--font-sans);
  font-size: var(--type-caption-strong-size);
  font-weight: var(--type-caption-strong-weight);
}
*/
