/* ==========================================================================
   Home page — extensions to the design system
   Builds on style-guide/styles.css. Page-specific layout only.
   ========================================================================== */

/* Narrower editorial column for the home page. The design system default
   (1100px) suits the style-guide's wide swatches/cards; a text-forward
   home page reads better in a tighter measure. */
:root {
  --col: 780px;
}

/* ----- Brand fruit cycler ------------------------------------------------ */
/* Replaces the .px-dot in the nav brand mark with a 7-fruit cycle that
   matches the brand-color rhythm. Same 12×12 footprint. */
.px-fruit {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
}
.px-fruit svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: px-fruit-cycle 5.6s steps(1) infinite;
}
.px-fruit svg:nth-child(1) { animation-delay: 0s; }
.px-fruit svg:nth-child(2) { animation-delay: -0.8s; }
.px-fruit svg:nth-child(3) { animation-delay: -1.6s; }
.px-fruit svg:nth-child(4) { animation-delay: -2.4s; }
.px-fruit svg:nth-child(5) { animation-delay: -3.2s; }
.px-fruit svg:nth-child(6) { animation-delay: -4.0s; }
.px-fruit svg:nth-child(7) { animation-delay: -4.8s; }
@keyframes px-fruit-cycle {
  0%, 14.28%   { opacity: 1; }
  14.29%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .px-fruit svg { animation: none; }
  .px-fruit svg:nth-child(1) { opacity: 1; }
}

/* ----- Brand mark (sun, spins on hover) ---------------------------------- */
.brand-mark {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  color: var(--ipe);
}
.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 200ms var(--ease-back, cubic-bezier(.34,1.56,.64,1));
  animation: sun-spin-load 800ms steps(8, end) 1;
}
.brand:hover .brand-mark svg,
.brand:focus-visible .brand-mark svg {
  animation: sun-spin 800ms steps(8, end) 1;
}
@keyframes sun-spin-load {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark svg { animation: none; }
}

/* ----- Hero -------------------------------------------------------------- */
.home-hero {
  padding: 24px 0 8px;
}
.home-hero .h-page {
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  max-width: 30ch;
}
.home-hero .lede {
  margin-top: 8px;
  margin-bottom: 0;
}
.hero-socials,
.foot-socials {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.foot-socials {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.foot-socials a {
  color: var(--ink-1);
}
.foot-socials a:hover,
.foot-socials a:focus-visible {
  color: var(--bougainvillea-strong);
}

/* ----- Section heads on the home page ------------------------------------ */
.home-section {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}
.home-section:first-of-type {
  border-top: 0;
}
.home-section .section-head {
  margin-bottom: 24px;
}
.home-section .section-head .h-sub {
  margin: 0;
}
.home-section .section-head .mono {
  margin-left: auto;
}

/* ----- Work grid — 2-column tiles ---------------------------------------- */
.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}
.work-row {
  display: block;
}
.work-row--featured {
  grid-column: 1 / -1;
}
.work-row a {
  display: block;
  text-decoration: none;
  color: var(--ink);
}
.work-row .thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  border: 2px solid var(--line-2);
  margin-bottom: 16px;
  overflow: hidden;
  transition: transform var(--t-fast) var(--ease-back), box-shadow var(--t-med) var(--ease), border-color var(--t-med) var(--ease), background-color var(--t-med) var(--ease);
}
.work-row--featured .thumb {
  aspect-ratio: 16 / 7;
}
.work-row a:hover .thumb {
  transform: translate(-4px, -4px);
}
.thumb-lock,
.work-row .thumb > .thumb-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-1);
  pointer-events: none;
}
.thumb-lock svg {
  width: 16px;
  height: auto;
  fill: currentColor;
}
/* Per-tile accent — tinted bg at rest, saturated border + shadow on hover */
/* Thumb color cycle: tijuca → ipanema → bougainvillea → ipe → sky.
   Applied by position so the pattern holds no matter which case studies are added or removed. */
.work-list > .work-row:nth-child(5n+1) .thumb { background: var(--tijuca-50); }
.work-list > .work-row:nth-child(5n+2) .thumb { background: var(--ipanema-50); }
.work-list > .work-row:nth-child(5n+3) .thumb { background: var(--bougainvillea-50); }
.work-list > .work-row:nth-child(5n+4) .thumb { background: var(--ipe-50); }
.work-list > .work-row:nth-child(5n+5) .thumb { background: var(--sky-50); }

.work-list > .work-row:nth-child(5n+1) a:hover .thumb { border-color: var(--tijuca);        box-shadow: 6px 6px 0 var(--tijuca); }
.work-list > .work-row:nth-child(5n+2) a:hover .thumb { border-color: var(--ipanema);       box-shadow: 6px 6px 0 var(--ipanema); }
.work-list > .work-row:nth-child(5n+3) a:hover .thumb { border-color: var(--bougainvillea); box-shadow: 6px 6px 0 var(--bougainvillea); }
.work-list > .work-row:nth-child(5n+4) a:hover .thumb { border-color: var(--ipe);           box-shadow: 6px 6px 0 var(--ipe); }
.work-list > .work-row:nth-child(5n+5) a:hover .thumb { border-color: var(--sky);           box-shadow: 6px 6px 0 var(--sky); }

/* Earlier-work list continues the color cycle from the 4-item main list.
   Offset by +4 so its first row uses position-5 (sky). */
.work-list.work-list--earlier > .work-row:nth-child(5n+1) .thumb { background: var(--sky-50); }
.work-list.work-list--earlier > .work-row:nth-child(5n+2) .thumb { background: var(--tijuca-50); }
.work-list.work-list--earlier > .work-row:nth-child(5n+3) .thumb { background: var(--ipanema-50); }
.work-list.work-list--earlier > .work-row:nth-child(5n+4) .thumb { background: var(--bougainvillea-50); }
.work-list.work-list--earlier > .work-row:nth-child(5n+5) .thumb { background: var(--ipe-50); }

.work-list.work-list--earlier > .work-row:nth-child(5n+1) a:hover .thumb { border-color: var(--sky);           box-shadow: 6px 6px 0 var(--sky); }
.work-list.work-list--earlier > .work-row:nth-child(5n+2) a:hover .thumb { border-color: var(--tijuca);        box-shadow: 6px 6px 0 var(--tijuca); }
.work-list.work-list--earlier > .work-row:nth-child(5n+3) a:hover .thumb { border-color: var(--ipanema);       box-shadow: 6px 6px 0 var(--ipanema); }
.work-list.work-list--earlier > .work-row:nth-child(5n+4) a:hover .thumb { border-color: var(--bougainvillea); box-shadow: 6px 6px 0 var(--bougainvillea); }
.work-list.work-list--earlier > .work-row:nth-child(5n+5) a:hover .thumb { border-color: var(--ipe);           box-shadow: 6px 6px 0 var(--ipe); }

/* Scroll-focus: mirror the hover lift when a card is centered in the viewport.
   Toggled by JS (.is-focused on .work-row) so the effect fires on scroll,
   especially on touch devices where there's no pointer hover. */
.work-row.is-focused .thumb {
  transform: translate(-4px, -4px);
}
/* When the lift is driven by scroll (not the cursor), animate it more slowly
   and with smooth easing. .scroll-anim is added by JS and kept through the
   release so both the lift-in and settle-back feel gentle. */
.work-row.scroll-anim .thumb {
  transition:
    transform 520ms var(--ease),
    box-shadow 520ms var(--ease),
    border-color 520ms var(--ease),
    background-color 520ms var(--ease);
}
.work-list > .work-row:nth-child(5n+1).is-focused .thumb { border-color: var(--tijuca);        box-shadow: 6px 6px 0 var(--tijuca); }
.work-list > .work-row:nth-child(5n+2).is-focused .thumb { border-color: var(--ipanema);       box-shadow: 6px 6px 0 var(--ipanema); }
.work-list > .work-row:nth-child(5n+3).is-focused .thumb { border-color: var(--bougainvillea); box-shadow: 6px 6px 0 var(--bougainvillea); }
.work-list > .work-row:nth-child(5n+4).is-focused .thumb { border-color: var(--ipe);           box-shadow: 6px 6px 0 var(--ipe); }
.work-list > .work-row:nth-child(5n+5).is-focused .thumb { border-color: var(--sky);           box-shadow: 6px 6px 0 var(--sky); }

.work-list.work-list--earlier > .work-row:nth-child(5n+1).is-focused .thumb { border-color: var(--sky);           box-shadow: 6px 6px 0 var(--sky); }
.work-list.work-list--earlier > .work-row:nth-child(5n+2).is-focused .thumb { border-color: var(--tijuca);        box-shadow: 6px 6px 0 var(--tijuca); }
.work-list.work-list--earlier > .work-row:nth-child(5n+3).is-focused .thumb { border-color: var(--ipanema);       box-shadow: 6px 6px 0 var(--ipanema); }
.work-list.work-list--earlier > .work-row:nth-child(5n+4).is-focused .thumb { border-color: var(--bougainvillea); box-shadow: 6px 6px 0 var(--bougainvillea); }
.work-list.work-list--earlier > .work-row:nth-child(5n+5).is-focused .thumb { border-color: var(--ipe);           box-shadow: 6px 6px 0 var(--ipe); }

@media (prefers-reduced-motion: reduce) {
  .work-row.is-focused .thumb { transform: none; }
}

/* Inline lock icon in work eyebrow */
.eyebrow-lock {
  width: 8px;
  height: 9px;
  fill: currentColor;
  display: inline-block;
  vertical-align: -1px;
  margin: 0 2px 0 1px;
}
.work-row .thumb > * {
  position: relative;
  z-index: 1;
}
.work-row--featured .thumb {
  aspect-ratio: auto;
  padding: 40px 50px 0;
  display: block;
}
.work-row--featured .thumb img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: -160px;
  border-radius: var(--r-sm);
  border: 1px solid #D1D9E0;
}
/* Centered (no bleed) variant — for device mockups / illustrations */
.work-row--featured .thumb--center {
  padding: 32px 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.work-row--featured .thumb--center img {
  width: auto;
  max-width: 100%;
  max-height: 420px;
  margin: 0;
  border-radius: 0;
  border: 0;
}
@media (max-width: 720px) {
  .work-row--featured .thumb {
    padding: 16px 16px 0;
    aspect-ratio: auto;
  }
}
.work-row-body { padding: 0 2px; }
.work-row .work-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-1);
  margin: 0 0 6px;
}
.work-row .title {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--ink);
}
.work-row .blurb {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-1);
  margin-top: 10px;
  max-width: 64ch;
}
.work-row .meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 720px) {
  .work-list { grid-template-columns: 1fr; gap: 32px; }
  .work-row--featured .thumb { aspect-ratio: 4 / 3; }
}

/* Outcome pill — small, restrained */
.outcome {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--line);
  color: #6B6050;
  white-space: nowrap;
}
.outcomes {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ----- Foot row (contact CTA) ------------------------------------------- */
.foot-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 80px 0 0;
  margin-top: 0;
}
.work-more-row {
  display: flex;
  justify-content: center;
  padding: 48px 0 0;
}
.work-more {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: color .15s ease;
}
.work-more:hover {
  color: var(--ink);
}
.work-more-icon {
  width: 8px;
  height: 5px;
  transition: transform .18s ease;
}
.work-more[aria-expanded="true"] .work-more-icon {
  transform: rotate(180deg);
}
.work-list--earlier {
  margin-top: 24px;
}
.work-list--earlier[hidden] {
  display: none;
}
.flags {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
  vertical-align: -1px;
}
.flag {
  display: inline-block;
  shape-rendering: crispEdges;
  image-rendering: pixelated;
  border-radius: 1px;
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 720px) {
  .work-row .title { font-size: 19px; }
  .home-section { padding: 40px 0; }
  .foot-row { gap: 12px; }
}

/* ==========================================================================
   Cursor-companion picker — floating button + overlay panel
   ========================================================================== */
.pal-toggle {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 50;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 22px -10px rgba(17,17,17,.18);
  transition:
    transform var(--t-med) var(--ease-back),
    box-shadow var(--t-med) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.pal-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(17,17,17,.22);
  border-color: var(--tijuca);
}
.pal-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.pal-toggle:active { transform: translateY(0) scale(.96); }
.pal-toggle-fruit { display: inline-flex; }
.pal-toggle-fruit svg { shape-rendering: crispEdges; image-rendering: pixelated; display: block; }

/* Cursor pal — slightly smaller than the design-system default */
.px-pal { width: 24px; height: 28px; }

.pal-panel {
  position: fixed;
  left: 24px;
  bottom: 88px;
  z-index: 51;
  width: 280px;
  padding: 18px 18px 34px;
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 48px -20px rgba(17,17,17,.22), 0 4px 14px -8px rgba(17,17,17,.10);
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transform-origin: 28px calc(100% + 28px);
  transition:
    opacity var(--t-med) var(--ease),
    transform var(--t-med) var(--ease-back);
  pointer-events: none;
}
.pal-panel[hidden] { display: none; }
.pal-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pal-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.pal-panel-hint {
  font-size: 13px;
  color: var(--ink-1);
  margin: 0 0 14px;
}
.pal-close {
  background: none;
  border: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-1);
  cursor: pointer;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pal-close:hover { background: var(--line); color: var(--ink); }
.pal-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.pal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px 6px;
}
.pal-opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-back);
}
.pal-opt:hover {
  background: var(--line);
}
.pal-opt:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.pal-opt[aria-checked="true"] {
  background: var(--ipanema-50);
  border-color: var(--ipanema);
}
.pal-opt svg { shape-rendering: crispEdges; image-rendering: pixelated; display: block; }
.pal-opt .pal-opt-name {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-1);
  pointer-events: none;
  white-space: nowrap;
}
.pal-opt .pal-opt-name .en { display: none; }
.pal-opt:hover .pal-opt-name .pt,
.pal-opt:focus-visible .pal-opt-name .pt { display: none; }
.pal-opt:hover .pal-opt-name .en,
.pal-opt:focus-visible .pal-opt-name .en { display: inline; color: var(--ink); }

/* ----- First-visit attention: wiggle + hint bubble --------------------- */
.pal-toggle.is-introducing {
  animation: pal-wiggle 1100ms ease-in-out 1;
  transform-origin: 50% 70%;
}
@keyframes pal-wiggle {
  0%   { transform: rotate(0deg)   scale(1); }
  12%  { transform: rotate(-14deg) scale(1.08); }
  24%  { transform: rotate(12deg)  scale(1.08); }
  36%  { transform: rotate(-10deg) scale(1.06); }
  48%  { transform: rotate(8deg)   scale(1.04); }
  60%  { transform: rotate(-5deg)  scale(1.02); }
  72%  { transform: rotate(3deg)   scale(1.01); }
  100% { transform: rotate(0deg)   scale(1); }
}

.pal-hint {
  position: fixed;
  left: 76px;
  bottom: 80px;
  z-index: 52;
  padding: 10px 16px;
  background: var(--tijuca-50);
  color: var(--tijuca-strong);
  font-family: var(--font-sans, "Plus Jakarta Sans"), system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.4;
  font-weight: 500;
  border: 0;
  border-radius: var(--r-md, 10px);
  box-shadow: none;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 240ms var(--ease, ease), transform 240ms var(--ease, ease);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pal-hint.is-visible {
  opacity: 1;
  transform: translate(0, 0);
}
.pal-hint::before {
  content: "";
  position: absolute;
  left: 6px;
  bottom: -10px;
  width: 0;
  height: 0;
  border-top: 12px solid var(--tijuca-50);
  border-right: 12px solid transparent;
}
.pal-hint::after { content: none; }

/* Hide picker on touch / coarse pointers — cursor companion doesn't apply */
@media (pointer: coarse) {
  .pal-toggle, .pal-panel { display: none !important; }
  .pal-hint { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .pal-panel { transition: opacity 0.001ms, transform 0.001ms; }
  .pal-toggle { transition: none; }
  .pal-toggle.is-introducing { animation: none; }
  .pal-hint { transition: opacity 0.001ms; }
}
