/* =========================================================================
   Urban Commons Research Collective — landing page
   -------------------------------------------------------------------------
   Every size below is derived from the Figma export (1512px frame, 1460px
   content measure) but expressed fluidly: each token interpolates between a
   small-screen floor and the design value, then locks. Nothing is a fixed
   pixel width, so the layout holds from ~320px up to any desktop size.
   ========================================================================= */

/* ---------------------------------------------------------------- Fonts -- */

@font-face {
  font-family: 'Season Mix';
  src: url('../fonts/SeasonMix-Regular.woff2') format('woff2'),
    url('../fonts/SeasonMix-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Inter, variable — latin then latin-ext */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------- Tokens -- */

:root {
  /* Palette — sampled from the export; accents come from the wordmark SVG */
  --bg: #f2eee7;
  --ink: #0a1314;
  --surface: #e6ded1;
  --accent: #2fac66;
  --white: #fff;
  --pink: #ffc4ff;
  --blue: #009fe3;
  --orange: #e94e1b;

  --font-display: 'Season Mix', georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, blinkmacsystemfont, 'Helvetica Neue', arial, sans-serif;

  /* Measure and rhythm */
  --content-max: 91.25rem;                                    /* 1460 */
  --pad: clamp(1rem, 0.79rem + 0.883vw, 1.625rem);            /*  16 →  26 */
  --gap: clamp(0.75rem, 0.582rem + 0.707vw, 1.25rem);         /*  12 →  20 */
  --gap-project-row: clamp(0.5rem, 0.36rem + 0.583vw, 0.875rem); /* 8 → 14 */
  --gap-people-row: clamp(0.75rem, 0.6rem + 0.62vw, 1.1875rem);  /* 12 → 19 */

  /* Distance from the viewport edge to the content edge on wide screens */
  --edge: max(var(--pad), calc((100vw - var(--content-max)) / 2));

  /* Type */
  --fs-body: clamp(0.9375rem, 0.917rem + 0.088vw, 1rem);      /*  15 →  16 */
  --fs-lead: clamp(1.0625rem, 0.958rem + 0.442vw, 1.375rem);  /*  17 →  22 */
  --fs-chrome: clamp(1.0625rem, 0.958rem + 0.442vw, 1.375rem);/*  17 →  22 */
  --fs-wordmark: clamp(1.5rem, 1.248rem + 1.06vw, 2.25rem);   /*  24 →  36 */
  --fs-head: clamp(2.125rem, 1.496rem + 2.65vw, 4rem);        /*  34 →  64 */

  /* Vertical rhythm between blocks */
  --space-mark-offset: clamp(2.5rem, -1.234rem + 15.724vw, 13.625rem); /* 40 → 218 */
  --space-mark: clamp(2.5rem, 1.494rem + 4.24vw, 5.5rem);     /*  40 →  88 */
  --space-title: clamp(1.75rem, 1.163rem + 2.474vw, 3.5rem);  /*  28 →  56 */
  --space-section: clamp(4.5rem, 2.656rem + 7.774vw, 10rem);  /*  72 → 160 */
  --space-footer: clamp(4.75rem, 2.736rem + 8.48vw, 10.75rem);/*  76 → 172 */
  --space-lead: clamp(1rem, 0.685rem + 1.325vw, 1.9375rem);   /*  16 →  31 */
  --space-cardtext: clamp(1.25rem, 0.904rem + 1.458vw, 2.28125rem); /* 20 → 36.5 */

  /* Card padding */
  --pad-card-y: clamp(1rem, 0.895rem + 0.442vw, 1.3125rem);   /*  16 →  21 */
  --pad-card-x: clamp(1rem, 0.875rem + 0.53vw, 1.375rem);     /*  16 →  22 */
  --pad-person-top: clamp(0.75rem, 0.645rem + 0.442vw, 1.0625rem); /* 12 → 17 */
  --pad-person-bottom: clamp(1rem, 0.87rem + 0.55vw, 1.5rem); /*  16 →  24 */

  /* Icons */
  --icon-external: clamp(2rem, 1.63rem + 1.55vw, 2.875rem);   /*  32 →  46 */
  --icon-link: clamp(1.5rem, 1.33rem + 0.71vw, 2rem);         /*  24 →  32 */
  --icon-mail: clamp(1.75rem, 1.5rem + 1.06vw, 2.5rem);       /*  28 →  40 */

  /* Collapsed wordmark — the target the hero mark animates into */
  --mark-min-w: clamp(8.75rem, 5.5rem + 13.69vw, 18.4375rem); /* 140 → 295 */
  --mark-min-x: var(--edge);
  --mark-min-y: clamp(1.25rem, 0.904rem + 1.458vw, 2.28125rem); /* 20 → 36.5 */

  /* Floating contact button: sits on the bottom edge, inset from the right */
  --contact-gap: clamp(1rem, 0.329rem + 2.827vw, 3rem);       /*  16 →  48 */
  --contact-pad-y: clamp(0.75rem, 0.65rem + 0.44vw, 1rem);    /*  12 →  16 */
  --contact-pad-x: clamp(1rem, 0.875rem + 0.53vw, 1.375rem);  /*  16 →  22 */
  --contact-pad-bottom: clamp(1.25rem, 1rem + 1.06vw, 2rem);  /*  20 →  32 */

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----------------------------------------------------------------- Base -- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-block: var(--pad);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.3125;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
svg { display: block; }

.wrap {
  max-width: calc(var(--content-max) + var(--pad) * 2);
  margin-inline: auto;
  padding-inline: var(--pad);
}

:where(a, button):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 20;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-body);
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ----------------------------------------------------------------- Hero -- */

/* The intro spans both rows so the wordmark's position is set by the title
   alone — the intro can reflow to any depth without shifting the mark. */
.hero__top {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--gap);
}

.hero__title {
  grid-column: 1 / 3;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: var(--fs-wordmark);
  font-weight: 400;
  line-height: 1.14;
}

.hero__intro {
  grid-column: 3 / 5;
  grid-row: 1 / span 2;
}

.lead {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  line-height: 1.34;
}

.hero__body {
  max-width: 36em;
  margin-top: var(--space-lead);
}
.hero__body p + p { margin-top: clamp(0.5rem, 0.42rem + 0.35vw, 0.75rem); }

/* ------------------------------------------------------------- Wordmark -- */

/* The SVG carries 0.535% of slack to the left of the U, so a small negative
   margin sits the letterforms flush with the content edge rather than the box */
.mark {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 90.89%;
  margin-top: var(--space-mark-offset);
  margin-left: -0.486%;
}

.mark__svg {
  width: 100%;
  height: auto;
  fill: var(--ink);
  /* The ink's top-left inside the viewBox — the anchor the collapse scales
     around, so the mark shrinks into its corner rather than its bounding box */
  transform-origin: 0.535% 6.378%;
  will-change: transform;
}

.mark__link { stroke-width: 20; }
.mark__link--pink { stroke: var(--pink); }
.mark__link--blue { stroke: var(--blue); }
.mark__link--orange { stroke: var(--orange); }

/* Never painted — the script measures this to learn where the mark collapses to */
.mark__target {
  position: fixed;
  left: var(--mark-min-x);
  top: var(--mark-min-y);
  width: var(--mark-min-w);
  height: calc(var(--mark-min-w) * 685 / 1296.6);
  visibility: hidden;
  pointer-events: none;
}

/* -------------------------------------------------------------- Section -- */

.section:first-of-type { margin-top: var(--space-mark); }
.section + .section { margin-top: var(--space-section); }

/* max-width in em keeps the design's line breaks identical at every size */
.section__title {
  max-width: 16em;
  margin-bottom: var(--space-title);
  font-size: var(--fs-head);
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -0.042em;
}

/* ------------------------------------------------------------- Projects -- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(30rem, 100%), 1fr));
  gap: var(--gap-project-row) var(--gap);
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  min-height: clamp(10rem, 12.63vw, 11.9375rem);
  height: 100%;
  padding: var(--pad-card-y) var(--pad-card-x);
  border: 1px solid var(--ink);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.project__name {
  grid-column: 1;
  font-family: var(--font-display);
  font-size: var(--fs-chrome);
  font-weight: 400;
  line-height: 1.3;
}

/* 30.9em reproduces the design's line breaks in all four cards, and because
   it is em-based it keeps them identical as the type scales down */
.project__text {
  grid-column: 1 / -1;
  max-width: 30.9em;
  margin-top: var(--space-cardtext);
}

.icon--external {
  grid-column: 2;
  grid-row: 1;
  width: var(--icon-external);
  height: var(--icon-external);
  justify-self: end;
}

.project--link:hover,
.project--link:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}
.project--link:focus-visible { outline-color: var(--accent); }

/* --------------------------------------------------------------- People -- */

.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  gap: var(--gap-people-row) var(--gap);
}

.people__note { grid-column: span 2; }

.person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: space-between;
  height: 100%;
  min-height: clamp(5rem, 6.61vw, 6.25rem);
  padding: var(--pad-person-top) var(--pad-card-x) var(--pad-person-bottom);
  border-radius: 0.5rem;
  background: var(--surface);
  line-height: 1.3;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.person__name,
.person--note {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: var(--fs-chrome);
}

.icon--link {
  grid-column: 2;
  width: var(--icon-link);
  height: var(--icon-link);
  justify-self: end;
  align-self: end;
  transform: rotate(-45deg);
}

a.person:hover,
a.person:focus-visible {
  background: var(--ink);
  color: var(--bg);
}

.person--note { align-content: start; }

/* --------------------------------------------------------------- Footer -- */

.footer {
  margin-top: var(--space-footer);
  font-family: var(--font-display);
  font-size: var(--fs-chrome);
  line-height: 1.3;
}

/* -------------------------------------------------------------- Contact -- */

.contact {
  position: fixed;
  right: var(--contact-gap);
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 0.4rem + 0.42vw, 0.75rem);
  margin: 0;
  padding: var(--contact-pad-y) var(--contact-pad-x) var(--contact-pad-bottom);
  border: 0;
  background: var(--white);
  box-shadow: 0 -1px 2px rgb(10 19 20 / 5%), 0 -8px 24px rgb(10 19 20 / 7%);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--fs-chrome);
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.contact:hover { background: var(--ink); color: var(--white); }

.icon--mail {
  width: var(--icon-mail);
  height: var(--icon-mail);
  flex: none;
}

/* ---------------------------------------------------------- Responsive -- */
/* Layout changes only — every size above already scales fluidly.
   These come last so they win over the base rules they override. */

/* Hero stacks: title, intro, then the wordmark full-width */
@media (max-width: 62rem) {
  .hero__top { grid-template-columns: minmax(0, 1fr); }
  .hero__title,
  .hero__intro,
  .mark { grid-column: 1; grid-row: auto; }
  .hero__intro { margin-top: var(--space-lead); }
  .hero__body { max-width: 42em; }
  .mark {
    width: 100%;
    margin-top: var(--space-mark);
    margin-left: -0.535%;
  }
}

/* Once the people grid is down to a single column, a 2-column note cell would
   conjure a phantom second track and wreck the row */
@media (max-width: 44rem) {
  .people__note { grid-column: auto; }
}

/* Keep the footer clear of the floating contact button */
@media (max-width: 48rem) {
  body { padding-bottom: calc(var(--pad) * 2 + var(--icon-mail) + 2rem); }
}

/* ------------------------------------------------------------- Motion -- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
