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

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -ms-touch-action: none;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -ms-touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  background: #332424;
  font-family: "Jost", sans-serif;
}

/* Wrap at word boundaries only — no hyphenation */
body,
.portfolio-card-label,
.portfolio-detail-title,
.portfolio-detail-description,
.tools-link,
.tools-blurb {
  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;
  word-break: normal;
  overflow-wrap: break-word;
}

#mosaic {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.tools-overlay {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.tools-overlay:not([hidden]) {
  pointer-events: auto;
}

.tools-list-inner {
  height: 100%;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.tools-columns-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 231, 207, 0.35) transparent;
}

.tools-columns-scroll::-webkit-scrollbar {
  height: 6px;
}

.tools-columns-scroll::-webkit-scrollbar-thumb {
  background: rgba(249, 231, 207, 0.35);
  border-radius: 3px;
}

.tools-columns {
  display: flex;
  flex-direction: row;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: flex-start;
  width: max-content;
  padding-bottom: 0.35rem;
}

.tools-column {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--tools-item-gap, 0.85rem);
  flex: 0 0 auto;
  width: clamp(10.5rem, 32vw, 15.5rem);
}

.tools-item {
  flex-shrink: 0;
  transform: scale(var(--tools-scale, 0));
  transform-origin: left center;
  will-change: transform, opacity;
}

.tools-link {
  font-family: "Jost", sans-serif;
  font-size: var(--tools-name-size, 1.3rem);
  font-weight: 500;
  color: #f9e7cf;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.tools-link:hover,
.tools-link:focus-visible {
  border-bottom-color: #f9e7cf;
  outline: none;
}

.tools-blurb {
  font-family: "Jost", sans-serif;
  font-size: var(--tools-blurb-size, 0.95rem);
  font-weight: 500;
  color: #f9e7cf;
  opacity: 0.55;
  margin-top: 0.2rem;
  line-height: 1.35;
  overflow: visible;
  white-space: normal;
}

.portfolio-overlay {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.portfolio-overlay:not([hidden]) {
  pointer-events: auto;
}

.portfolio-panel-inner,
.portfolio-grid-inner {
  height: 100%;
  padding: clamp(0.65rem, 1.5vw, 1rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  overflow: hidden;
  min-height: 0;
}

.portfolio-back-btn {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 0.15rem 0;
  border: none;
  background: none;
  font-family: "Jost", sans-serif;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 500;
  color: #f9e7cf;
  cursor: pointer;
}

.portfolio-back-btn:hover,
.portfolio-back-btn:focus-visible {
  text-decoration: underline;
  outline: none;
}

.portfolio-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portfolio-view[hidden] {
  display: none !important;
}

.portfolio-view--grid {
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.portfolio-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.45rem, 1.2vw, 0.75rem);
  width: 100%;
  max-height: 100%;
}

.portfolio-item {
  opacity: var(--portfolio-fade, 1);
  transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

/* Half of about headshot corner radius (9% → 4.5% of min side). */
.portfolio-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: none;
  background: #1a1212;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  container-type: size;
  border-radius: 4.5cqmin;
  box-shadow: inset 0 0 0 1px rgba(249, 231, 207, 0.2);
  transition:
    box-shadow 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  transform: scale(1);
}

.portfolio-card-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    filter 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  transform: scale(1);
}

.portfolio-card-shade {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease;
  pointer-events: none;
}

.portfolio-card-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  font-family: "Jost", sans-serif;
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  font-weight: 500;
  color: #f9e7cf;
  text-align: center;
  line-height: 1.25;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.portfolio-card:hover,
.portfolio-card:focus-visible {
  transform: scale(1.03);
  box-shadow:
    inset 0 0 0 1px rgba(249, 231, 207, 0.55),
    0 14px 32px rgba(0, 0, 0, 0.38);
}

.portfolio-card:hover .portfolio-card-img,
.portfolio-card:focus-visible .portfolio-card-img {
  filter: brightness(0.32) contrast(1.08);
  transform: scale(1.1);
}

.portfolio-card:hover .portfolio-card-shade,
.portfolio-card:focus-visible .portfolio-card-shade {
  background: rgba(0, 0, 0, 0.5);
}

.portfolio-card:hover .portfolio-card-label,
.portfolio-card:focus-visible .portfolio-card-label {
  opacity: 1;
}

.portfolio-card:focus-visible {
  outline: 1px solid #f9e7cf;
  outline-offset: 2px;
}

.portfolio-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(0.85rem, 2.5vw, 1.35rem);
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.portfolio-detail-title {
  flex: 0 0 auto;
  font-family: "Jost", sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 500;
  color: #f9e7cf;
  margin: 0;
}

.portfolio-detail-description {
  flex: 0 0 auto;
  font-family: "Jost", sans-serif;
  font-size: clamp(0.88rem, 1.9vw, 1.08rem);
  font-weight: 500;
  color: #f9e7cf;
  opacity: 0.82;
  line-height: 1.45;
  margin: 0;
  white-space: pre-line;
}

.portfolio-detail-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.85rem, 2.5vw, 1.35rem);
  align-content: start;
}

.portfolio-detail-item {
  opacity: var(--portfolio-fade, 1);
  transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
  flex: 0 0 auto;
}

.portfolio-detail-frame {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: #1a1212;
  overflow: hidden;
  cursor: pointer;
  border-radius: clamp(4px, 4.5%, 12px);
  box-shadow: inset 0 0 0 1px rgba(249, 231, 207, 0.2);
  font: inherit;
  color: inherit;
  text-align: inherit;
  transition:
    box-shadow 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  transform: scale(1);
}

.portfolio-detail-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 640px);
  object-fit: contain;
  margin: 0 auto;
  background: #1a1212;
  transform: scale(1);
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.portfolio-detail-frame:hover,
.portfolio-detail-frame:focus-visible {
  transform: scale(1.02);
  box-shadow:
    inset 0 0 0 1px rgba(249, 231, 207, 0.55),
    0 10px 26px rgba(0, 0, 0, 0.32);
}

.portfolio-detail-frame:hover .portfolio-detail-img,
.portfolio-detail-frame:focus-visible .portfolio-detail-img {
  transform: scale(1.06);
  filter: brightness(1.12) contrast(1.04);
}

.portfolio-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2.5rem, 8vw, 4rem) clamp(3rem, 10vw, 5rem);
  background: rgba(51, 36, 36, 0.94);
  touch-action: none;
}

.portfolio-lightbox[hidden] {
  display: none !important;
}

body.portfolio-lightbox-open {
  overflow: hidden;
}

.portfolio-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.portfolio-lightbox-counter {
  position: absolute;
  bottom: clamp(0.75rem, 3vh, 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: "Jost", sans-serif;
  font-size: clamp(0.75rem, 1.6vw, 0.9rem);
  font-weight: 500;
  color: #f9e7cf;
  opacity: 0.75;
}

.portfolio-lightbox-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(249, 231, 207, 0.35);
  background: rgba(51, 36, 36, 0.65);
  font-family: "Jost", sans-serif;
  font-weight: 500;
  color: #f9e7cf;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.portfolio-lightbox-btn:hover,
.portfolio-lightbox-btn:focus-visible {
  background: rgba(51, 36, 36, 0.9);
  border-color: #f9e7cf;
  outline: none;
}

.portfolio-lightbox-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.portfolio-lightbox-close {
  top: clamp(0.65rem, 2vh, 1rem);
  right: clamp(0.65rem, 2vw, 1rem);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 4.5cqmin;
  font-size: 1.35rem;
  line-height: 1;
}

.portfolio-lightbox-prev,
.portfolio-lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: clamp(2.75rem, 7vw, 3.75rem);
  height: clamp(3.25rem, 9vw, 4.5rem);
  border-radius: 4.5cqmin;
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  line-height: 1;
}

.portfolio-lightbox-prev {
  left: clamp(0.5rem, 2vw, 1rem);
}

.portfolio-lightbox-next {
  right: clamp(0.5rem, 2vw, 1rem);
}
