/* Home and project folders share the case's existing palette and file treatment.
   All selectors are confined to these pages; the CRT and intro stay untouched. */
.home-page {
  --home-grid: repeat(12, minmax(0, 1fr));
  --home-gutter: clamp(24px, 3vw, 48px);
  --home-inset: clamp(20px, 2.6vw, 36px);
  --home-border: #d5d9b43d;
  max-width: 1320px;
  min-width: 0;
  margin: 0 auto;
  padding: 63px 0 56px;
}

.home-page :where(section, div, figure, header, nav, button, a, span) {
  min-width: 0;
}

.home-page :where(h1, h2, h3, p, a, button, span) {
  overflow-wrap: break-word;
}

.home-page .eyebrow {
  display: block;
  margin: 0;
  font: 10px/1.65 Mono, monospace;
  letter-spacing: .11em;
}

.home-page :where(h1, h2, h3, .home-feature-title, .home-folder-title, .category-project-title) {
  font-family: "Space Grotesk", Liberation, sans-serif;
  font-weight: 400;
  text-wrap: balance;
}

.home-page .home-file {
  position: relative;
  border: 1px solid var(--home-border);
  background: #d5d9b403;
}

.home-page .home-tab,
.home-page .home-folder-tab {
  position: absolute;
  bottom: calc(100% - 1px);
  left: -1px;
  max-width: calc(100% + 2px);
  margin: 0;
  padding: 9px 16px;
  border: 1px solid var(--home-border);
  border-bottom-color: var(--black);
  border-radius: 5px 9px 0 0;
  background: var(--black);
  color: var(--yellow);
  font: 11px/1.4 Mono, monospace;
  letter-spacing: .055em;
}

/* A small, uncropped original portrait beside the introduction. */
.home-page .home-profile-grid {
  display: grid;
  grid-template-columns: var(--home-grid);
  gap: var(--home-gutter);
  align-items: center;
  padding: var(--home-inset);
}

.home-page .home-portrait {
  position: relative;
  grid-column: span 3;
  width: 100%;
  max-width: 238px;
  aspect-ratio: 700 / 657;
  margin: 0;
  background: var(--black);
  isolation: isolate;
}

.home-page .home-portrait > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 700 / 657;
  filter: grayscale(1) brightness(.72) contrast(.95);
  opacity: .9;
}

/* Both originals are RGB, 700 x 657. The white-on-black glasses mask must
   use luminance and the same full-image mapping, never alpha or a crop. */
.home-page .home-portrait-glasses {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
  background: var(--yellow);
  -webkit-mask-image: url("assets/images/avatar/lentes-mask.webp");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-image: url("assets/images/avatar/lentes-mask.webp");
  mask-mode: luminance;
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
  mask-position: center;
}

@supports (mask-mode: luminance) {
  .home-page .home-portrait-glasses { display: block; }
}

.home-page .home-bio { grid-column: span 9; }
.home-page .home-bio > .eyebrow { color: var(--yellow); }

.home-page .home-bio h1 {
  margin: 13px 0 12px;
  font-size: clamp(34px, 3.6vw, 53px);
  line-height: 1.08;
  letter-spacing: -.055em;
}

.home-page .home-roles {
  margin: 0;
  color: #c2c8b7;
  font: 11px/1.75 Mono, monospace;
}

.home-page .home-description {
  margin: 15px 0 0;
  color: #aeb6a0;
  font-size: 15px;
  line-height: 1.75;
}

.home-page .home-profile-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px 24px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.home-page .home-socials {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 19px;
}

.home-page .home-socials a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  font: 10px/1.6 Mono, monospace;
  color: #b8beac;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.home-page .home-socials a:hover {
  color: var(--yellow);
  text-decoration-line: underline;
}

.home-page .home-cv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 17px;
  border: 1px solid #d7d8ac40;
  color: var(--yellow);
  font: 11px/1.55 Mono, monospace;
}

.home-page .home-cv:hover {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--black);
}

/* A horizontal, readable featured file rather than another large hero. */
.home-page .home-feature { margin-top: 68px; }

.home-page .home-feature-link {
  display: grid;
  grid-template-columns: var(--home-grid);
  column-gap: var(--home-gutter);
  align-items: center;
  width: 100%;
  padding: 0;
  text-align: left;
}

.home-page .home-feature-copy {
  display: block;
  grid-column: span 5;
  padding: var(--home-inset) 0 var(--home-inset) var(--home-inset);
}

.home-page .home-feature-copy > .eyebrow { color: var(--yellow); }

.home-page .home-feature-title {
  display: block;
  margin: 19px 0 17px;
  font-size: clamp(29px, 3.3vw, 47px);
  line-height: 1.1;
  letter-spacing: -.05em;
}

.home-page .home-feature-description {
  display: block;
  margin: 0;
  color: #aeb6a0;
  font-size: 15px;
  line-height: 1.7;
}

.home-page .home-open-label {
  display: inline-block;
  margin-top: 26px;
  color: var(--yellow);
  font: 11px/1.65 Mono, monospace;
  text-underline-offset: 5px;
}

.home-page .home-feature-image {
  display: flex;
  grid-column: span 7;
  align-items: center;
  justify-content: center;
  height: clamp(280px, 28vw, 350px);
  margin: 10px 10px 10px 0;
  background: #090b08;
}

.home-page .home-feature-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-page .home-feature-link:hover .home-open-label,
.home-page .category-project:hover .home-open-label {
  text-decoration: underline;
}

/* Real folder buttons form the index; the small protruding number belongs
   to the same button and does not impersonate an independent tab control. */
.home-page .home-library { margin-top: 48px; }

.home-page .home-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px 30px;
  margin-bottom: 52px;
}

.home-page .home-section-heading h2 {
  margin: 0;
  font-size: clamp(27px, 2.6vw, 36px);
  line-height: 1.2;
  letter-spacing: -.045em;
}

.home-page .home-section-heading > .eyebrow { font-size: 9px; }

.home-page .home-folder-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 48px var(--home-gutter);
}

.home-page .home-folder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 9px 9px 17px;
  border: 1px solid var(--home-border);
  background: #d5d9b403;
  text-align: left;
}

.home-page .home-folder-tab {
  min-width: 51px;
  padding: 7px 13px;
  font-size: 10px;
}

.home-page .home-folder-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #090b08;
  border: 1px solid #d5d9b419;
}

.home-page .home-folder-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-page .home-pending-mark {
  color: #69705e;
  font: 38px/1 "Space Grotesk", Liberation, sans-serif;
}

.home-page .home-folder-meta {
  margin: 20px 7px 0;
  color: var(--muted);
  font: 8px/1.7 Mono, monospace;
  letter-spacing: .09em;
}

.home-page .home-folder-title {
  margin: 9px 7px 24px;
  font-size: clamp(20px, 1.8vw, 25px);
  line-height: 1.15;
  letter-spacing: -.035em;
}

.home-page .home-folder-open {
  margin: auto 7px 0;
  padding-top: 4px;
  color: var(--yellow);
  font: 9px/1.7 Mono, monospace;
}

.home-page .home-folder:hover,
.home-page .category-project:hover { border-color: #e5cd7177; }

.home-page .home-folder:hover .home-folder-tab {
  border-color: #e5cd7177;
  border-bottom-color: var(--black);
}

.home-page .home-folder:hover .home-folder-open {
  text-decoration: underline;
  text-underline-offset: 5px;
}

/* Category routes retain the same outer 12-column rhythm. */
.home-page.category-page { padding-top: 28px; }

.home-page .home-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  flex-wrap: wrap;
}

.home-page .home-breadcrumb .rental-text-link {
  min-height: 44px;
  font: 11px/1.6 Mono, monospace;
  color: var(--yellow);
  padding: 12px 0;
  text-align: left;
}

.home-page .home-breadcrumb .eyebrow { font-size: 9px; }

.home-page .category-tabs {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 9px;
  position: relative;
  z-index: 1;
  margin: 22px 0 -1px;
}

.home-page .category-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 15px;
  border: 1px solid var(--home-border);
  border-radius: 5px 9px 0 0;
  color: #aeb6a0;
  font: 10px/1.6 Mono, monospace;
  text-align: left;
}

.home-page .category-tabs button:hover { color: var(--yellow); }

.home-page .category-tabs button[aria-current="page"] {
  border-color: #e5cd7177;
  border-bottom-color: var(--black);
  background: var(--black);
  color: var(--yellow);
}

.home-page .category-file { padding: var(--home-inset); }

.home-page .category-heading {
  display: grid;
  grid-template-columns: var(--home-grid);
  column-gap: var(--home-gutter);
  align-items: end;
  padding: 3px 0 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.home-page .category-heading > * { grid-column: span 6; }
.home-page .category-heading .eyebrow { color: var(--yellow); }

.home-page .category-heading h1 {
  margin: 16px 0 0;
  font-size: clamp(35px, 4vw, 58px);
  line-height: 1.08;
  letter-spacing: -.055em;
}

.home-page .category-heading > p {
  margin: 0;
  color: #aeb6a0;
  font-size: 15px;
  line-height: 1.75;
}

.home-page .category-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--home-gutter);
}

.home-page .category-project {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 0;
  border: 1px solid var(--home-border);
  background: #d5d9b403;
  text-align: left;
}

.home-page .category-project-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  margin: 8px 8px 0;
  background: #090b08;
}

.home-page .category-project-image img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-page .home-image-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: var(--muted);
  font: 11px/1.7 Mono, monospace;
  letter-spacing: .08em;
}

.home-page .category-project-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 23px 20px;
}

.home-page .category-project-copy .eyebrow {
  font-size: 9px;
  letter-spacing: .065em;
}

.home-page .category-project-title {
  margin: 12px 0 14px;
  font-size: clamp(24px, 2.2vw, 31px);
  line-height: 1.14;
  letter-spacing: -.04em;
}

.home-page .category-project-description {
  margin: 0 0 24px;
  color: #aeb6a0;
  font-size: 13px;
  line-height: 1.75;
}

.home-page .category-project .home-open-label {
  margin-top: auto;
  font-size: 10px;
}

.home-page .category-pending {
  padding: 26px;
  border: 1px dashed var(--home-border);
  color: #aeb6a0;
  font: 12px/1.8 Mono, monospace;
}

.home-page .category-pending:empty { display: none; }
.home-page .category-project-grid:not(:empty) + .category-pending { margin-top: 30px; }
.home-page .category-pending p { margin: 0; }

/* Keep focus outside each clickable frame, away from image clipping. */
.home-page :where(button, a):focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 5px;
}

@media (max-width: 1119px) {
  .home-page .home-folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-page .home-folder-title { font-size: 26px; }
  .home-page .home-folder-preview { aspect-ratio: 16 / 9; }
  .home-page .category-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .home-page .home-portrait { grid-column: span 4; }
  .home-page .home-bio { grid-column: span 8; }
  .home-page .home-profile-links { margin-top: 18px; }
  .home-page .home-socials { width: 100%; gap: 2px 16px; }
  .home-page .home-feature-copy { grid-column: span 6; }
  .home-page .home-feature-image { grid-column: span 6; }
}

@media (max-width: 700px) {
  .home-page { padding-top: 56px; padding-bottom: 38px; }
  .home-page .home-profile-grid { align-items: start; }
  .home-page .home-bio h1 { font-size: 35px; }
  .home-page .home-description { font-size: 14px; }
  .home-page .home-roles { font-size: 10px; }
  .home-page .home-feature { margin-top: 62px; }
  .home-page .home-feature-link { display: block; }
  .home-page .home-feature-copy { padding: 26px var(--home-inset); }
  .home-page .home-feature-title { font-size: 36px; }
  .home-page .home-feature-image { height: 310px; margin: 0 8px 8px; }
  .home-page .home-open-label { margin-top: 21px; }
  .home-page .home-library { margin-top: 37px; }
  .home-page .home-section-heading { flex-wrap: wrap; gap: 10px; margin-bottom: 48px; }
  .home-page .home-section-heading > .eyebrow { width: 100%; font-size: 8px; }
  .home-page .home-folder-title { font-size: 23px; }
  .home-page.category-page { padding-top: 20px; }
  .home-page .home-breadcrumb .eyebrow { font-size: 8px; }
  .home-page .category-tabs { margin: 20px 0 -1px; gap: 8px; }
  .home-page .category-tabs button { padding: 10px 12px; font-size: 9px; }
  .home-page .category-heading { grid-template-columns: minmax(0, 1fr); row-gap: 22px; padding-bottom: 26px; }
  .home-page .category-heading > * { grid-column: 1 / -1; }
  .home-page .category-heading h1 { font-size: 39px; }
  .home-page .category-heading > p { font-size: 14px; }
  .home-page .category-project-grid { gap: 24px; }
}

@media (max-width: 600px) {
  .home-page .home-profile-grid { display: block; }
  .home-page .home-portrait { width: 46%; max-width: 180px; margin-bottom: 26px; }
  .home-page .home-bio h1 { font-size: clamp(31px, 8.5vw, 41px); }
  .home-page .home-bio > .eyebrow { font-size: 9px; }
  .home-page .home-feature-title { font-size: clamp(29px, 8vw, 38px); }
  .home-page .home-feature-image { height: clamp(205px, 62vw, 300px); }
  .home-page .home-folder-grid,
  .home-page .category-project-grid { grid-template-columns: minmax(0, 1fr); }
  .home-page .home-folder-title { font-size: 27px; }
  .home-page .home-folder-preview { aspect-ratio: 4 / 3; }
  .home-page .home-folder-meta { font-size: 9px; }
  .home-page .home-folder-open { font-size: 10px; }
  .home-page .home-tab { padding: 9px 13px; font-size: 10px; }
  .home-page .category-file { padding: 18px; }
  .home-page .category-heading h1 { font-size: clamp(31px, 8.5vw, 42px); }
  .home-page .category-project-copy { padding: 21px 16px; }
  .home-page .category-project-title { font-size: 27px; }
  .home-page .category-pending { padding: 20px 16px; font-size: 11px; }
}

/* Keep remote-image failure local to its media slot, without a broken-image glyph. */
.home-page .home-folder-preview { position: relative; }
.home-page .home-folder-preview img { position: relative; }
.home-page [data-cover][hidden] { display: none; }

/* V52 mobile category chips: stable DOM order and geometry for every selection.
   Inline above the file (not sticky); only the selected chip changes color. */
@media (max-width: 700px) {
  .home-page .category-tabs { margin: 20px 0 16px; gap: 8px; }
  .portfolio .home-page .category-tabs button {
    border-radius: 999px;
    border-style: solid;
    background: transparent;
    color: #aeb6a0;
  }
  .portfolio .home-page .category-tabs button:hover { color: #aeb6a0; }
  .portfolio .home-page .category-tabs button[aria-current="page"] {
    border-color: var(--yellow);
    background: var(--yellow);
    color: var(--black);
  }
}

/* V42: a shared content budget for all five folder headers. Each breakpoint
   reserves the longest title/description (including the fallback font), not
   just the active folder. Natural height remains available for text zoom.
   Explicit line metrics keep font swaps from moving the divider/card grid. */
.home-page .category-heading {
  --category-title-lines: 2;
  --category-description-lines: 3;
  --category-count-lines: 1;
  align-items: end;
}
.home-page .category-heading h1 {
  min-height: calc(var(--category-title-lines) * 1.08em);
}
.portfolio .home-page .category-heading .eyebrow {
  font-size: 20px;
  line-height: 24px;
  min-height: calc(var(--category-count-lines) * 24px);
}
.home-page .category-heading > p {
  min-height: calc(var(--category-description-lines) * 1.75em);
}
@media (max-width: 1119px) {
  .home-page .category-heading { --category-description-lines: 4; }
}
@media (max-width: 900px) {
  .home-page .category-heading { --category-description-lines: 5; --category-count-lines: 2; }
}
@media (max-width: 700px) {
  .home-page .category-heading {
    --category-title-lines: 1;
    --category-description-lines: 3;
    --category-count-lines: 1;
    align-items: start;
  }
}
@media (max-width: 600px) {
  .home-page .category-heading { --category-title-lines: 2; }
}
@media (max-width: 479px) {
  .home-page .category-heading { --category-description-lines: 5; --category-count-lines: 2; }
}
@media (max-width: 359px) {
  .home-page .category-heading { --category-title-lines: 3; --category-description-lines: 6; }
}

/* V47: two intentional title lines, including short category names. Keep the
   established type size unless the shared longest line needs a narrow-screen cap.
   The 7.2em budget includes the final punctuation and decorative caret. */
.home-page .category-heading { --category-title-lines: 2; }
.home-page .category-heading > div { container-type: inline-size; }
.home-page .category-heading h1 { font-size: min(clamp(35px, 4vw, 58px), 13.88cqw); }
.home-page .category-title-line { display: block; white-space: nowrap; }
@media (max-width: 700px) {
  .home-page .category-heading h1 { font-size: min(39px, 13.88cqw); }
}
@media (max-width: 600px) {
  .home-page .category-heading h1 { font-size: min(clamp(31px, 8.5vw, 42px), 13.88cqw); }
}
